2021-12-21 18:12:59 -07:00

23 lines
434 B
Lua

modpol.util = {}
--- @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.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