Module:TestMod: Difference between revisions

From Hazeron Wiki
Jump to navigation Jump to search
(testing)
mNo edit summary
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 .. " arguments."

Revision as of 10:21, 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 .. " arguments."
end

return p