Site Notice
hello, world
Module:Util
From Project-EPB Commons
Documentation for this module may be created at Module:Util/doc
-- 常用Lua工具集
local p = {}
-- 获取表长度
function p.tabelLength(tbl)
local length = 0
for k, v in pairs(tbl) do
length = length + 1
end
return length
end
-- 返回表中含有value值的key
function p.valueInTable(tbl, value)
local final = {}
for k, v in pairs(tbl) do
if v == value then
final[k] = v
end
end
return final
end
return p