Module:Sandbox/Luis150902

--This is a test created by Luis150902

local test = {} local getArgs = require("Module:Arguments").getArgs local yesno = require("Module:Yesno")

function test.f1(frame) local args = getArgs(frame) return mw.ustring.len(args["1"]) end

function test.f2(frame) local args = getArgs(frame) local i = 0 for j in args do		i = i + 1 end return i end

function test.f3(frame) local args = getArgs(frame) local op = args["1"] if (op == nil) or (op == "") or (op == "") then op = args["s"] if (op == nil) or (op == "") or (op == "") then return 0 end end if (op == "+") then return test._f3_0(args) end if (op == "-") then return test._f3_1(args) end if (op == "*") then return test._f3_2(args) end if (op == "/") then return test._f3_3(args) end if (op == "%") then return test._f3_4(args) end if (op == "!") then return test._f3_5(args) end end

function test._f3_0(args) local a = args["2"] if (a == nil) or (a == "") or (a == "") then a = args["a"] if (a == nil) or (a == "") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "") or (b == "") then a = args["b"] if (b == nil) or (b == "") or (b == "") then return 0 end end return a + b end

function test._f3_1(args) local a = args["2"] if (a == nil) or (a == "") or (a == "") then a = args["a"] if (a == nil) or (a == "") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "") or (b == "") then a = args["b"] if (b == nil) or (b == "") or (b == "") then return 0 end end return a - b end

function test._f3_2(args) local a = args["2"] if (a == nil) or (a == "") or (a == "") then a = args["a"] if (a == nil) or (a == "") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "") or (b == "") then a = args["b"] if (b == nil) or (b == "") or (b == "") then return 0 end end return a * b end

function test._f3_3(args) local a = args["2"] if (a == nil) or (a == "") or (a == "") then a = args["a"] if (a == nil) or (a == "") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "") or (b == "") then a = args["b"] if (b == nil) or (b == "") or (b == "") then return 0 end end return a / b end

function test._f3_4(args) local a = args["2"] if (a == nil) or (a == "") or (a == "") then a = args["a"] if (a == nil) or (a == "") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "") or (b == "") then a = args["b"] if (b == nil) or (b == "") or (b == "") then return 0 end end return a % b end

function test._f3_5(args) local a = args["2"] if (a == nil) or (a == "") or (a == "") then a = args["a"] if (a == nil) or (a == "") or (a == "") then return 0 end end local result = yesno(a) if result then return "false" else return "true" end end

return test