Module:LuaCall: Difference between revisions

From Test Wiki
Content deleted Content added
p.import -args.tag
+doc for p.import, optimize some
Line 42: Line 42:
end
end


-- This function is modified from https://en.wikipedia.org/wiki/Module:Ustring?oldid=885619921
-- All frame's arguments are coerced as number type if possible. If you wish for something to remain a string, you can simply escape it by insert \ at the beginning of the string.
function p.import(o)
function p.import(o)
local p = {}
local p = {}
Line 51: Line 53:
args[_] = tonumber(v) or v:gsub("^\\", "", 1)
args[_] = tonumber(v) or v:gsub("^\\", "", 1)
end
end
return (o[k](unpack(args)))
return (v(unpack(args)))
end
end
end
end