Module:PickRow: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 10: | Line 10: | ||
if row[column] ~= args.filter then | if row[column] ~= args.filter then | ||
for c, _ in ipairs(row) do | for c, _ in ipairs(row) do | ||
row[c] = 0 | if tab.schema.fields[c].type == "number" then | ||
row[c] = 0 | |||
end | |||
end | end | ||
end | end | ||
Revision as of 20:26, 11 January 2026
Documentation for this module may be created at Module:PickRow/doc
local p = {}
local column = 0
function p.pick_row(tab, args)
if tonumber(args.column) > 0 then
column = tonumber(args.column)
end
for _, row in ipairs(tab.data) do
if row[column] ~= args.filter then
for c, _ in ipairs(row) do
if tab.schema.fields[c].type == "number" then
row[c] = 0
end
end
end
end
return tab
end
return p