Module:TestMod: Difference between revisions
Jump to navigation
Jump to search
(testing) |
(number seems to be 1 higher than intended) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
function p.countArgs( frame ) | function p.countArgs( frame ) | ||
local args = frame.args | local args = frame.args | ||
local i = | local i = 1 | ||
while args[i] do i = i + 1 end | while args[i] do i = i + 1 end | ||
return "You entered " .. i .. " arguments." | return "You entered " .. i - 1 .. " arguments." | ||
end | end | ||
return p | return p |
Latest revision as of 11:00, 18 April 2024
Basic test Lua module, can be invoked with {{#invoke: TestMod|FunctionName|arg1|arg2|etc ...}}
local p = {} --p stands for package function p.countArgs( frame ) local args = frame.args local i = 1 while args[i] do i = i + 1 end return "You entered " .. i - 1 .. " arguments." end return p