Module:Convert: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>Uncle G Started module. |
meta>WOSlinker No edit summary |
||
Line 6: | Line 6: | ||
-- This is the top-level function called by {{convert}}. | -- This is the top-level function called by {{convert}}. | ||
function p.main(frame, config, args) | function p.main(frame, config, args) | ||
local pframe = frame:getParent() | local pframe = frame:getParent(); | ||
local args = pframe.args -- the arguments passed TO the {{convert}} template, in the wikitext that instantiates the template | local args = pframe.args; -- the arguments passed TO the {{convert}} template, in the wikitext that instantiates the template | ||
local config = frame.args -- the arguments passed BY the {{convert}} template, in the wikitext of the template itself | local config = frame.args; -- the arguments passed BY the {{convert}} template, in the wikitext of the template itself | ||
error ("Module:Convert is not implemented") | local output; | ||
return | |||
val1 = tonumber(args(1)); | |||
val2 = tonumber(args(3)); | |||
if val1 == nil then | |||
error ("Module:Convert value not supplied"); | |||
return "" | |||
end | |||
if val2 == nil then | |||
-- Single value supplied | |||
else | |||
-- Two values supplied | |||
end | |||
error ("Module:Convert is not implemented"); | |||
return output | |||
end | end | ||
return p | return p |
Revision as of 17:55, 2 September 2012
Documentation for this module may be created at Module:Convert/doc
--require "mw.text"
--require "mw.page"
local p = {}
-- This is the top-level function called by {{convert}}.
function p.main(frame, config, args)
local pframe = frame:getParent();
local args = pframe.args; -- the arguments passed TO the {{convert}} template, in the wikitext that instantiates the template
local config = frame.args; -- the arguments passed BY the {{convert}} template, in the wikitext of the template itself
local output;
val1 = tonumber(args(1));
val2 = tonumber(args(3));
if val1 == nil then
error ("Module:Convert value not supplied");
return ""
end
if val2 == nil then
-- Single value supplied
else
-- Two values supplied
end
error ("Module:Convert is not implemented");
return output
end
return p