feat: add new table functions
This commit is contained in:
parent
98af0eda2a
commit
8c41bce128
1 changed files with 16 additions and 0 deletions
|
@ -52,10 +52,26 @@ function Table.toString(table)
|
||||||
return string .. "}"
|
return string .. "}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Table.clone(table1)
|
||||||
|
local returnTable = {}
|
||||||
|
for key, value in pairs(table1) do
|
||||||
|
returnTable[key] = value
|
||||||
|
end
|
||||||
|
return returnTable
|
||||||
|
end
|
||||||
|
|
||||||
function Table.mergeList(table1, table2)
|
function Table.mergeList(table1, table2)
|
||||||
for i, value in ipairs(table2) do
|
for i, value in ipairs(table2) do
|
||||||
table.insert(table1, value)
|
table.insert(table1, value)
|
||||||
end
|
end
|
||||||
|
return table1
|
||||||
|
end
|
||||||
|
|
||||||
|
function Table.merge(table1, table2)
|
||||||
|
for key, value in pairs(table2) do
|
||||||
|
table1[key] = value
|
||||||
|
end
|
||||||
|
return table1
|
||||||
end
|
end
|
||||||
|
|
||||||
function Table.reduce(list, fn)
|
function Table.reduce(list, fn)
|
||||||
|
|
Loading…
Reference in a new issue