User:Patrick

From Wikipedia

mw:User:Patrick1/lua

The content of Template:Lang is {{#invoke:Language|lang}}. In spite of this simple content, due to Module:Language using getParent (see Wikipedia:Guide_to_Scribbling#Receiving_template_arguments and mw:Extension:Scribunto/Parser_interface_design#Parent_frame_access the result depends on parameters: if a page invokes Module:Language indirectly by transcluding a page that does this invocation (in this case the template), then with pframe = frame:getParent() we have that pframe.args is the table of parameters in this transclusion.

Function lang in the module contains:

local pframe = frame:getParent()
local args = pframe.args
local config = frame.args -- parameters in the invocation of Module:Language, other than the function (in this case none)
local language = args[1] or ""
local contents = args[2] or ""    

Lua error in Module:Xpd at line 19: attempt to concatenate local 'tplname' (a nil value).

(wikitext: <span lang="zh" xml:lang="zh">年</span>[[Category:Articles containing Chinese language text]])

aScript error: The function "lang" does not exist.b