mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 22:24:35 +00:00
removed needless branch in tablex.shallow_copy
This commit is contained in:
parent
81512550bb
commit
9f5dfcb923
11
tablex.lua
11
tablex.lua
@ -333,14 +333,11 @@ end
|
|||||||
-- See shallow_overlay to shallow copy into an existing table to avoid garbage.
|
-- See shallow_overlay to shallow copy into an existing table to avoid garbage.
|
||||||
function tablex.shallow_copy(t)
|
function tablex.shallow_copy(t)
|
||||||
assert:type(t, "table", "tablex.shallow_copy - t", 1)
|
assert:type(t, "table", "tablex.shallow_copy - t", 1)
|
||||||
if type(t) == "table" then
|
local into = {}
|
||||||
local into = {}
|
for k, v in pairs(t) do
|
||||||
for k, v in pairs(t) do
|
into[k] = v
|
||||||
into[k] = v
|
|
||||||
end
|
|
||||||
return into
|
|
||||||
end
|
end
|
||||||
return t
|
return into
|
||||||
end
|
end
|
||||||
|
|
||||||
--alias
|
--alias
|
||||||
|
Loading…
Reference in New Issue
Block a user