Difference between revisions of "Module:Sandbox/Erutuon/random"
< Module:Sandbox | Erutuon
Jump to navigation
Jump to search
blackwiki>Erutuon (namespace function) |
blackwiki>Erutuon (to understand how parameters work...) |
||
| Line 7: | Line 7: | ||
function p.currentFrame(frame) | function p.currentFrame(frame) | ||
| − | currentFrame = mw.getCurrentFrame(frame) | + | local currentFrame = mw.getCurrentFrame(frame) |
local frameTable = {} | local frameTable = {} | ||
for k, v in pairs(currentFrame) do | for k, v in pairs(currentFrame) do | ||
| Line 17: | Line 17: | ||
function p.namespace(frame) | function p.namespace(frame) | ||
return frame:getParent():getTitle() | return frame:getParent():getTitle() | ||
| + | end | ||
| + | |||
| + | function p.parameterContent(frame) | ||
| + | local parameter = frame.args[1] | ||
| + | return parameter == "" and "Parameter is empty" or parameter == nil and "Parameter is nil" or "Parameter contains " .. parameter | ||
end | end | ||
return p | return p | ||
Revision as of 20:54, 8 October 2016
Test
- Script error: The function "show" does not exist.
local p = {}
function p.test(frame)
local word = frame.args[1] == "print" and "Printing is allowed"
return word
end
function p.currentFrame(frame)
local currentFrame = mw.getCurrentFrame(frame)
local frameTable = {}
for k, v in pairs(currentFrame) do
frameTable[k] = v
end
return frameTable and table.concat(frameTable, ", ") or "nil"
end
function p.namespace(frame)
return frame:getParent():getTitle()
end
function p.parameterContent(frame)
local parameter = frame.args[1]
return parameter == "" and "Parameter is empty" or parameter == nil and "Parameter is nil" or "Parameter contains " .. parameter
end
return p