Hey,
Does anybody know if there is a way to pass all arguments to a Scribunto script? In other words, to have a template and to pass all template arguments into the script invokation? And if there isn't a way to do this, is it possible to develop a way to do so? Because that would make things a lot easier for the Lua version of ArticleHistory I'm working on.
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
On 03/09/12 11:22, Tyler Romeo wrote:
Hey,
Does anybody know if there is a way to pass all arguments to a Scribunto script? In other words, to have a template and to pass all template arguments into the script invokation? And if there isn't a way to do this, is it possible to develop a way to do so? Because that would make things a lot easier for the Lua version of ArticleHistory I'm working on.
All arguments of the calling template are always accessible to Lua, using frame:getParent().args. You should use that mechanism where possible to avoid lengthy parameter lists to #invoke, which are slow to parse.
frame:getParent() returns an object with the same methods as the original frame. Sorry, I haven't gotten around to adding it to the reference manual yet, but there is a discussion of it in https://www.mediawiki.org/wiki/Extension:Scribunto/Parser_interface_design
-- Tim Starling
wikitech-l@lists.wikimedia.org