Module:TestMod: Difference between revisions
Jump to navigation
Jump to search
(Testing some slightly more advanced functionality) |
mNo edit summary |
||
Line 2: | Line 2: | ||
function p.hello( frame ) | function p.hello( frame ) | ||
local i = {} | |||
local args = frame.args | local args = frame.args | ||
while args[i] do i = i + 1 end | while args[i] do i = i + 1 end |
Revision as of 15:26, 17 April 2024
Basic test Lua module, can be invoked with {{#invoke: TestMod|FunctionName|arg1|arg2|etc ...}}
local p = {} --p stands for package function p.hello( frame ) local i = {} local args = frame.args while args[i] do i = i + 1 end local OutText = i .. "arguments were provided. The module will now check for the existence of arg5 and print it if set. " if(arg[5]) then OutText = OutText .. arg[5] end return OutText --return "This should have printed the first argument you entered: " .. args[1] .. "!" end return p