Module:TableTools: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(valueIntersection: fix error message function name) |
(remove shallowClone - hardly worth having this in here) |
||
Line 55: | Line 55: | ||
return false |
return false |
||
end |
end |
||
end |
|||
--[[ |
|||
------------------------------------------------------------------------------------ |
|||
-- shallowClone |
|||
-- |
|||
-- This returns a clone of a table. The value returned is a new table, but all |
|||
-- subtables and functions are shared. Metamethods are respected, but the returned |
|||
-- table will have no metatable of its own. |
|||
------------------------------------------------------------------------------------ |
|||
--]] |
|||
function p.shallowClone(t) |
|||
local ret = {} |
|||
for k, v in pairs(t) do |
|||
ret[k] = v |
|||
end |
|||
return ret |
|||
end |
end |
||