Files
modpol/modpol_core/util/misc.lua
2021-12-20 21:28:54 -07:00

20 lines
388 B
Lua

--- @function modpol.copy_table
-- Returns a copy of the table inputted
function modpol.util.copy_table(t)
local t2 = {}
for k,v in pairs(t) do
t2[k] = v
end
return t2
end
--- @function modpol.copy_table
-- Returns the number of elements in a pairs table
function modpol.util.num_pairs(t)
local i = 0
for k,v in pairs(t) do
i = i + 1
end
return i
end