Module:Convert: Difference between revisions

Content deleted Content added
move arg extraction to its own function to allow _convert() to be called from other lua modules
 
Line 3,712:
end
 
local function main_convert_main_convert(confArgs, parmsArgs, frame)
-- Do convert, and if needed, do it again with higher default precision.
local parms = { frame = frame or mw.getCurrentFrame() } -- will hold template arguments, after translation
set_config(frame.argsconfArgs)
local success, result = get_parms(parms, frame:getParent().argsparmsArgs)
if success then
if type(result) ~= 'table' then
Line 3,751:
end
return success and result or message(parms, result)
end
 
local function main_convert(frame)
return _main_convert(frame.args, frame:getParent().args, frame)
end
 
Line 3,835 ⟶ 3,839:
end
 
return { convert = main_convert, _convert = _main_convert, _unit = _unit }