Module:Infobox MOS: Difference between revisions

Ganaram inukshuk (talk | contribs)
Split "main" function into a wrapper function (called by template) and "main function" (called by wrapper)
Ganaram inukshuk (talk | contribs)
Fixed wrong args being passed
Line 47: Line 47:
-- Main function
-- Main function
-- To be called by wrapper
-- To be called by wrapper
function p._infobox_MOS(input_mos, debug_mode, other_names)
function p._infobox_MOS(tuning, debug_mode, other_names)
local mos = input_mos or MOS.new(5, 2)
local tuning = tuning or "5L 2s"
local debug_mode = debug_mode == true
local debug_mode = debug_mode == true
local other_names = other_names or nil
local other_names = other_names or nil
local mos = MOS.parse(tuning)
local tuning = MOS.as_string(mos)
-- category of the main article
-- category of the main article
Line 276: Line 275:
function p.infobox_MOS(frame)
function p.infobox_MOS(frame)
local input_mos = frame.args['Tuning']
local tuning = frame.args['Tuning']
local other_names = frame.args['Other names'] or nil
local other_names = frame.args['Other names'] or nil
local debug_mode = frame.args['debug'] ~= nil
local debug_mode = frame.args['debug'] ~= nil
return p._infobox_MOS(input_mos, debug_mode, other_names)
return p._infobox_MOS(tuning, debug_mode, other_names)


end
end