table: get rid of unneeded metatable duplication

master
Lars Mueller 2021-02-27 17:16:30 +01:00
parent 5e3fd2048e
commit ca6757f326
1 changed files with 3 additions and 2 deletions

View File

@ -1,14 +1,15 @@
-- Table helpers
function map_index(table, func)
return setmetatable(table, {
local mapping_metatable = {
__index = function(table, key)
return rawget(table, func(key))
end,
__newindex = function(table, key, value)
rawset(table, func(key), value)
end
})
}
return setmetatable(table, mapping_metatable)
end
function set_case_insensitive_index(table)