GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - EvandroLG/set-lua: `set-lua` is a complete implementation of the Set data structure in Lua

BranchesTags
Open more actions menu

Latest commit

 

History

20 Commits
20 Commits

Folders and files

NameName
Last commit message
Last commit date
src/Set
src/Set
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
set-lua-1.2.0-0.rockspec
set-lua-1.2.0-0.rockspec
 
 
test.lua
test.lua
 
 

Repository files navigation

set-lua · Build Status license

set-lua is a complete implementation of the Set data structure.

In computer science, a set is an abstract data type that can store unique values, without any particular order. It is a computer implementation of the mathematical concept of a finite set. Unlike most other collection types, rather than retrieving a specific element from a set, one typically tests a value for membership in a set. - Wikipedia

Installation

To install set-lua, run:

$ luarocks install set-lua

Usage

local Set = require('Set')
local list = Set({ 'banana', 'apple', 'kiwi' })

list.has('banana') -- true
list.has('orange') -- false

list.delete('banana') -- true

list.insert('orange')
list.has('orange') -- true

API

Properties

  • Set.items:table
    Items presented in Set.

  • Set.size:number
    Current Set length.

Methods

  • Set.insert(value:any):void
    Appends value to the Set object.

  • Set.has(value:any):boolean
    Checks if value is present in the Set object or not.

  • Set.clear():void
    Removes all items from the Set object.

  • Set.delete(value:any):boolean
    Removes item from the Set object and returns a boolean value asserting wheater item was removed or not.

  • Set.each(callback:function):void
    Removes item from the Set object and returns a boolean value asserting wheater item was removed or not.

  • Set.every(callback:function):boolean
    Returns true whether all items pass the test provided by the callback function.

  • Set.union(s1[, s2, ...]: Set):Set
    Returns a new Set that contains all items from the original Set and all items from the specified Sets.

  • Set.intersection(s1[, s2, ...]: Set):Set
    Returns a new Set that contains all elements that are common in all Sets.

  • Set.difference(s1[, s2, ...]: Set):Set
    Returns a new Set that contains the items that only exist in the original Set.

  • Set.symmetric_difference(s2: Set):Set
    Returns a symetric difference of two Sets.

  • Set.is_superset(subset: Set):boolean
    Returns true if set has all items present in the subset.

License

MIT

About

`set-lua` is a complete implementation of the Set data structure in Lua

Resources

Readme
MIT license
Activity

Stars

10 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.