mirror of
https://github.com/appgurueu/modlib.git
synced 2025-02-18 09:03:46 +01:00
rolling-13
This commit is contained in:
15
table.lua
15
table.lua
@ -1,5 +1,20 @@
|
||||
-- Table helpers
|
||||
|
||||
function map_index(table, func)
|
||||
return setmetatable(roles, {
|
||||
__index = function(table, key)
|
||||
return rawget(table, func(key))
|
||||
end,
|
||||
__newindex = function(table, key, value)
|
||||
rawset(table, func(key), value)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function set_case_insensitive_index(table)
|
||||
return map_index(table, string.lower)
|
||||
end
|
||||
|
||||
-- Fisher-Yates
|
||||
function shuffle(t)
|
||||
for i = 1, #t-1 do
|
||||
|
Reference in New Issue
Block a user