Module:LimitWinnerInput

local p = {} require('Module:StrManip')

function p.test local input = trim(tostring("AAAAAAAAAAA"):lower:gsub("^%l", string.upper)):gsub(" -%(.*%) -","") mw.log(isint(tonumber(input))) end

function p.main local input = mw.getCurrentFrame.args[1] --local input = "AAAAAAAA" local out = "" mw.logObject(input) local res = "" ind = trim(tostring(input):lower):gsub(" -%(.*%) -","") mw.log(ind) if not ind then mw.log("empty") return elseif isint(tonumber(ind)) then win = ind elseif ind:lower:find("yes") then mw.log("winner") win = 1 elseif ind:lower:find("no") then mw.log("not winner") win = 0 else mw.log("invalid input") return "Valid values are \"Yes\" (1) and \"No\" (0).\nSee Help:Guidelines." end if tonumber(win) > 0 then out = "Yes" else out = "No" end

mw.logObject(out) return out end

function isint(n) if n ~= NIL then return n==math.floor(n) else return false end end

return p