Extension talk:Lua

Ubuntu install not quite working
Using the 28 Dec 2008 snapshot.

The Lua50 package on my Feisty system complained about the Lua ... syntax and wouldn't run the code at all.

Hand compiled and installed Lua 5.14. Had to manually apt-get libreadline-dev to provide readline.h.

Now it runs OK, but argument passing from the Lua tag is not working under MediaWiki 1.11.1

The example program:

Produces: Error on line 2: bad argument #2 to 'format' (string expected, got nil) print(hello("literal string")) works fine.

It doesn't help to substitute a literal string into the lua tag, either.  does not work for me. -- MaxEnt 02:34, 29 December 2008 (UTC)
 * [[Image:Yes check.svg|15px]] Yes. There is either an error in the given example either in the code of the wrapper. This is due to the underscore _ in the name of the variable: if you remove these, there will be no more error. Lua could accept underscores (see Lua reference §2.1) but it should be MW which don't like it in a parser hook. ~ Seb35 14:17, 23 August 2009 (UTC)

No luck on Cygwin, either
I have another wiki running on a Windows machine, version 1.12.x. I've installed both the plain Windows Lua 1.5.4 and the Cygwin binary. Both of these work fine from the command line.

Run from within MediaWiki, the Windows binary freezes up my Apache server, until I kill the stuck Lua process manually.

Got a bit further with the Cygwin version, once I ensured that the required Cygwin DLL was in my path. However, every page comes back "internal error" in big red letters.

I added some debug statements to the PHP code and determined that the wrapper is managing to construct, and the correct command is written to the Lua process, but only one line of output comes back, and this line is blank.

Working remotely, I wanted to see if the Windows Lua would get as far. Instead I managed to hose my Apache pretty good. A manual Apache stop/start cycle from the Cygwin SSH shell did not unlock the server. Running the System Internals process tools from the command line, pslist hangs with no output, and sometimes I can't even terminate the stuck pslist with ^C.

I'm sure there's a stuck Lua process causing these problems. I guess I'll have to kill it via a local VNC session tomorrow. --MaxEnt 05:57, 30 December 2008 (UTC)

Is there a running Version?
I tried it under Windows, Xampp 1.7.1, MediaWiki 1.15.0 and Lua 5.1.4 (Binaries from the Binaries Page). On Command-Line Lua ist running, but in MediaWiki it crashes in busy..... Is there a running version? Christian Weiss, 23. Jun 2009 16:52 +0200
 * Perhaps see the first section above. Else could you give your error (what it displays). ~ Seb35 14:17, 23 August 2009 (UTC)

Lua in templates
I was trying to do some templating with this extension and it didn't work (like the program in Lua following). By investigating, it was not possible to define an argument  because MediaWiki doesn't parse the arguments in a tag. To solve this, here is a patch.

It could be possible also to add $parser->replaceVariables($input,$frame,true) into $parser->recursiveTagParse($wgLua->wrap($input)) to replace also the template arguments in the main Lua code. But I don't know if it is desirable and not dangerous.

Lua in templates
I've tried to use this extension in the Wikipedia templates. I found it is very useful for calculating templates, but not in the templates like the infoboxes.

For instance, here is the french template fr:Modèle:DAYINYEAR365. I have modified the extension Lua to allow to include the parameters of a template in &lt;lua>.

But I found it is unuseful in a infobox, since you have multiple units like  .

~ Seb35 17:05, 6 September 2009 (UTC)

Scribunto
Could someone who knows add a note on the extension page explaining whether this extension is superseded by Extension:Scribunto? Thanks. Sumana Harihareswara, Wikimedia Foundation Engineering Community Manager (talk) 18:32, 3 May 2012 (UTC)