feat: add new table functions

This commit is contained in:
Kazhnuz 2021-06-06 19:18:53 +02:00
parent 98af0eda2a
commit 8c41bce128

View file

@ -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)