Difference between revisions of "Module:LuaExample"
From A Wiki in the Desert
(Created page with "local p = {} --p stands for package function p.hello( frame ) return "Hello, world! "..frame.args[1] end return p") |
|||
| Line 3: | Line 3: | ||
function p.hello( frame ) | function p.hello( frame ) | ||
return "Hello, world! "..frame.args[1] | return "Hello, world! "..frame.args[1] | ||
| + | end | ||
| + | |||
| + | function p.hello_table(frame) | ||
| + | local result = "" | ||
| + | for k,v in pairs( frame.args ) do | ||
| + | result = result .. ' ' .. k .. ' '.. v .. '\n' | ||
| + | end | ||
| + | return result | ||
end | end | ||
return p | return p | ||
Latest revision as of 23:36, 16 May 2021
Documentation for this module may be created at Module:LuaExample/doc
local p = {} --p stands for package
function p.hello( frame )
return "Hello, world! "..frame.args[1]
end
function p.hello_table(frame)
local result = ""
for k,v in pairs( frame.args ) do
result = result .. ' ' .. k .. ' '.. v .. '\n'
end
return result
end
return p