Jump to content

Module:PickRow: Difference between revisions

From p1gwars
No edit summary
No edit summary
Line 8: Line 8:


     for _, row in ipairs(tab.data) do
     for _, row in ipairs(tab.data) do
        mw.log(row[column])
         if row[column] ~= "Tijgertje I" then
         if row[column] ~= "Tijgertje I" then
             for c, _ in ipairs(row) do
             for c, _ in ipairs(row) do
                 if tab.schema.fields[c].type == "number" then
                 if tab.schema.fields[c].type == "number" then
                     row[c] = 1
                     row[c] = 0
                 end
                 end
             end
             end

Revision as of 20:29, 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
        mw.log(row[column])
        if row[column] ~= "Tijgertje I" 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