词条 | 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 == "{{{1}}}") or (op == "") then op = args["s"] if (op == nil) or (op == "{{{1}}}") 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 == "{{{2}}}") or (a == "") then a = args["a"] if (a == nil) or (a == "{{{2}}}") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "{{{3}}}") or (b == "") then a = args["b"] if (b == nil) or (b == "{{{3}}}") 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 == "{{{2}}}") or (a == "") then a = args["a"] if (a == nil) or (a == "{{{2}}}") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "{{{3}}}") or (b == "") then a = args["b"] if (b == nil) or (b == "{{{3}}}") 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 == "{{{2}}}") or (a == "") then a = args["a"] if (a == nil) or (a == "{{{2}}}") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "{{{3}}}") or (b == "") then a = args["b"] if (b == nil) or (b == "{{{3}}}") or (b == "") then return 0 end end end function test._f3_3(args) local a = args["2"] if (a == nil) or (a == "{{{2}}}") or (a == "") then a = args["a"] if (a == nil) or (a == "{{{2}}}") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "{{{3}}}") or (b == "") then a = args["b"] if (b == nil) or (b == "{{{3}}}") 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 == "{{{2}}}") or (a == "") then a = args["a"] if (a == nil) or (a == "{{{2}}}") or (a == "") then return 0 end end local b = args["3"] if (b == nil) or (b == "{{{3}}}") or (b == "") then a = args["b"] if (b == nil) or (b == "{{{3}}}") 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 == "{{{2}}}") or (a == "") then a = args["a"] if (a == nil) or (a == "{{{2}}}") or (a == "") then return 0 end end local result = yesno(a) if result then return "false" else return "true" end end return test |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。