New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

luvit-set

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

luvit-set

Straightforward Lua Set library for Luvit

latest
npmnpm
Version
0.0.1-5
Version published
Weekly downloads
10
400%
Maintainers
1
Weekly downloads
 
Created
Source

#luvit-set Straightforward Lua Set library for Luvit

##Install

  • Download and install Node.js. Then you have npm
  • In the root of your Luvit project, npm install luvit-set

##Usage Start off with

local Set = require("luvit-set")

Then, to create a set (of things you like):

local ilike = Set:new()

to add items to a set:

ilike:add("apples")
ilike:add("bananas")

or, initialise with values on creation:

local ilike = Set:new({"apples", "bananas"})

Let's create another set:

local ulike = Set:new({"apples", "strawberries"})

Then we can:

local welike     = ilike + ulike -- union:        apples, bananas, strawberries
local webothlike = ilike * ulike -- intersection: apples
local udontlike  = ilike - ulike -- subtraction:  bananas

Lastly, some conveniences:

local somethingilike = ilike:anelement()
ilike:len()  -- 2
for k, _ in pairs(ilike) do
  print(k)
end
print(ilike) -- '{"apples", "bananas"}'
local list = ilike:tolist() -- {"apples", "bananas"}

##Tests npm test luvit-set

##License LGPL+; see the LICENSE file

Keywords

set

FAQs

Package last updated on 13 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts