IndexedHashmap - An Indexable Dictionary Object

About

A dictionary object that is indexable. Refer to Usage for further details.

Links

Roblox Model: IndexedHashmap - Roblox
GitHub Gist Source: indexedhashmap.lua · GitHub

Usage:

local IndexedHashmap = require(path.to.IndexedHashmap)

local hashmap = IndexedHashmap:new()
hashmap['lol'] = 'test'
hashmap['a'] = 'b'

print("IPAIRS:")
for i, v in IndexedHashmap.ipairs(hashmap) do
	print(i, v)
    -- 1 test
    -- 2 b
end

print("PAIRS:")
for k, v in IndexedHashmap.pairs(hashmap) do
	print(k, v)
    -- lol test
    -- a b
end

print("IKPAIRS:")
for i, k, v in IndexedHashmap.ikpairs(hashmap) do
	print(i, k, v)
    -- 1 lol test
    -- 2 a b
end

The model stealers already got to it lol.

4 Likes