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/Map: Map works like a hashtable but preserving the key insertion order

BranchesTags
Open more actions menu

Latest commit

 

History

12 Commits
12 Commits

Folders and files

NameName
Last commit message
Last commit date
src/Map
src/Map
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
map-1.0.0-0.rockspec
map-1.0.0-0.rockspec
 
 
test.lua
test.lua
 
 

Repository files navigation

Map · Build Status license

Map works like a hashtable but preserving the key insertion order.

Installation

To install Map, run:

$ luarocks install map

Usage

local Map = require('Map')
local bill = Map()

bill.set('name', 'Bill Gates')
bill.set('age', 65)

bill.has('name') -- true
bill.has('company') -- false

bill.get('name') -- 'Bill Gates'
bill.get('age') -- 65
bill.get('company') -- nil

bill.each(function(key, value)
  print(key .. ' = ' .. value)
end)
-- name = Bill Gates
-- age = 65

API

Properties

  • Map.items:table
    Table holds key-values pairs.

  • Map.keys:table
    List of inserted keys.

  • Map.values:table
    List of inserted values.

  • Map.size:number
    Current Map length.

Methods

  • Map.set(key:any, value:any):void
    Sets a key to a value.

  • Map.get(key:any):any
    Returns the value associated to the key.

  • Map.has(key:any):boolean
    Returns the value associated to the key.

  • Map.delete(key:any):boolean
    Removes item by key and returns true in case of success and false if the item doesn't exist in the Map.

  • Map.each(callback:function):void
    Calls function once for each item present in the Map object preserving insertion order.

License

MIT

About

Map works like a hashtable but preserving the key insertion order

Resources

Readme
MIT license
Activity

Stars

4 stars

Watchers

1 watching

Forks

0 forks
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.