rolling-13

This commit is contained in:
Lars Mueller 2020-04-05 10:42:44 +02:00
parent 2e0eb885c4
commit 4ee679f187
2 changed files with 22 additions and 7 deletions

@ -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