mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 01:03:46 +01:00
rolling-13
This commit is contained in:
parent
2e0eb885c4
commit
4ee679f187
15
table.lua
15
table.lua
@ -1,5 +1,20 @@
|
|||||||
-- Table helpers
|
-- 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
|
-- Fisher-Yates
|
||||||
function shuffle(t)
|
function shuffle(t)
|
||||||
for i = 1, #t-1 do
|
for i = 1, #t-1 do
|
||||||
|
Loading…
Reference in New Issue
Block a user