Changes

m
no edit summary
Line 25: Line 25:  
function Utils.map(tbl, fn)
 
function Utils.map(tbl, fn)
 
local result = {}
 
local result = {}
for i, v in pairs(tbl) do
+
for _, v in pairs(tbl) do
result[i] = fn(v)
+
table.insert(result, fn(v))
 
end
 
end
 
return result
 
return result
 
end
 
end
 
+
 
function Utils.filter(tbl, pred)
 
function Utils.filter(tbl, pred)
 
local result = {}
 
local result = {}
for i, v in pairs(tbl) do
+
for _, v in pairs(tbl) do
 
if pred(v) then
 
if pred(v) then
result[i] = v
+
table.insert(result, v)
 
end
 
end
 
end
 
end
cssedit, gkautomate
7,064

edits