Module:Util

-- Some Useful Lua Modules -- Some modules are taken from the Internet local p = {} -- Get Template Arguments function p.getArgs return require('Module:Arguments').getArgs end -- Get Table Length function p.tableLength(tbl) local length = 0 for k, v in pairs(tbl) do   length = length + 1 end return length end -- Table Has Key function p.hasKey(tbl, key) if tbl == nil then return false end for k, v in pairs(tbl) do   if k == key then return true end end return false end -- Table Has Value function p.hasValue(tbl, value) if tbl == nil then return false end for k, v in pairs(tbl) do   if tbl[k] == value then return true end end return false end -- Key Of Value function p.keyOfValue(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