Difference between revisions of "Module:Test"
Jump to navigation
Jump to search
Line 21: | Line 21: | ||
cf = mw.getCurrentFrame() | cf = mw.getCurrentFrame() | ||
arg1 = cf.args[1] | arg1 = cf.args[1] | ||
if arg1 == 1 then | if arg1 == "1" then | ||
return mw.allToString(cf.args[2]) | return mw.allToString(cf.args[2]) | ||
elseif arg1 == 2 then | elseif arg1 == "2" then | ||
return mw.allToString(cf.args[3]) | return mw.allToString(cf.args[3]) | ||
else | else |
Revision as of 13:12, 9 August 2021
Documentation for this module may be created at Module:Test/doc
p = {}
function p.hello_world(a)
cf = mw.getCurrentFrame()
return "Hello, world! from " .. mw.allToString(cf.args[3]) .. "-" .. mw.allToString(cf.args[1]) .."-" ..mw.allToString(cf.args[2])
end
function p.greek_letter()
cf = mw.getCurrentFrame()
-- aString = "<math>\\" .. mw.allToString(cf.args[1]) .. "</math>"
aString = "<math>\\pi</math>"
return aString
end
function p.rawstring()
cf = mw.getCurrentFrame()
return mw.allToString(cf.args[1])
end
function p.selector()
cf = mw.getCurrentFrame()
arg1 = cf.args[1]
if arg1 == "1" then
return mw.allToString(cf.args[2])
elseif arg1 == "2" then
return mw.allToString(cf.args[3])
else
return "Error"
end
end
return p