Talk:Lua/Tutorial

Your Two Cents
As all things wiki, this is a living document. I encourage you to improve it. While it is new (or undergoing any significant changes), you may want to share your ideas, here, on the Talk page. Thanks for your contributions! Deeb (talk) 00:31, 31 May 2012 (UTC)

On performance, loading data, etc.
Someone asked Brad what the constraints of Lua within Scribunto were. He said:


 * It depends on what the question means by "constraints". It certainly is a constraint that Lua can only get input as text strings passed to the and what can be fetched via frame:expandTemplate,  frame:preprocess, and the like. There's also the constraint that it can  only output wikitext not including pre-save transforms or transclusions  and other  constructs. It's  also a constraint that all Lua in the page is limited to 10 seconds CPU  time. And relative to standard Lua, Scribunto's Lua lacks all sorts of  functions (see mw:Extension:Scribunto/Lua reference manual).


 * Performance gains: Some templates are used to store data, and are invoked with #ifexist: in a main template. There are thousands of such "data"  templates.  With Lua, it's a lot more efficient to deal with a large  data structure in one module than a  in wikitext can handle.  The   function (probably coming to your wiki with MediaWiki  version 1.21wmf11; see the  deployment schedule) helps there too by only having to load  that data once per page no matter how many times the module is  #invoked.  Lua is pretty good about loading large blobs of static data,  and mw.loadData avoids the overhead of reparsing for each #invoke, so in  general things should be pretty good there.

Sharihareswara (WMF) (talk) 03:29, 13 March 2013 (UTC)