mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
add table.merge_replace
This commit is contained in:
parent
aa5bd51206
commit
cfacc3dd48
1 changed files with 12 additions and 0 deletions
|
|
@ -57,6 +57,18 @@ function table.merge(t1, t2)
|
||||||
return t1
|
return t1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function table.merge_replace(t1, t2)
|
||||||
|
for i, v in pairs(t2) do
|
||||||
|
if type(i) == "number" then
|
||||||
|
t1[#t1 + 1] = v
|
||||||
|
else
|
||||||
|
t1[i] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return t1
|
||||||
|
end
|
||||||
|
|
||||||
function table.map(t, func)
|
function table.map(t, func)
|
||||||
for i, v in pairs(t) do
|
for i, v in pairs(t) do
|
||||||
t[i] = func(i, v)
|
t[i] = func(i, v)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue