blob: eb983d3211c44ebad59b9ce2bfffa2205b8320fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
function table:extend(other)
if type(other) == 'table' then
for _, value in ipairs(other) do
self[#self + 1] = value
end
else
for value in other do
self[#self + 1] = value
end
end
end
function table:merge(other)
for key, value in pairs(other) do
self[key] = value
end
end
function table.from_iter(iter)
local t = {}
for value in iter do
t[#t + 1] = value
end
return t
end
|