2021-12-28 14:39:34 -07:00

26 lines
488 B
Lua

modpol.util = {}
--- @function modpol.copy_table
-- @param t table
-- Returns a copy of the table inputted
function modpol.util.copy_table(t)
local t2 = {}
if pairs(t) then
for k,v in pairs(t) do
t2[k] = v
end
end
return t2
end
--- @function modpol.num_pairs
-- @param t table with pairs
-- 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