模組:Graph:MultiChart/sandbox
外观
![]() | 这是Module:Graph:MultiChart(差异)的沙盒。 |
local p={}
local lib_arg={}
--{{#invoke:沙盒/a2569875/Graph:MultiChart|mergeChart}}
function p.mergeChart(frame)
local args, working_frame
if frame == mw.getCurrentFrame() then
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
if lib_arg.getArgs == nil then lib_arg = require('Module:Arguments') end
in_args = lib_arg.getArgs(frame, {parentFirst=true})
working_frame = frame
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
working_frame = mw.getCurrentFrame()
args = (type(frame) == type('')) and {frame} or ((type((frame or {}).args)==type({})) and frame.args or frame)
end
local json, success = args['1'] or args[1], true
if mw.text.trim(json) == '' then return '' end
success, json = pcall(mw.text.jsonDecode, json, mw.text.JSON_TRY_FIXING )
if not success then return '' end
return mw.logObject(json)
end
return p