On 29/02/12 09:01, Owen Davis wrote:
Keeping this lua thread alive with some news. :)
For anyone interested in playing around with Lua on a wiki, I've
enabled the Lua extension on
http://lua.wikia.com It's just a test
wiki right now with no real content. It will probably remain a
test wiki, although if users want to flesh it out into a more
authoritative site, that would be cool too. I am using
http://www.mediawiki.org/wiki/Extension:Lua
Right now I've experimented a little bit and run across some
questions.
Question 1) is that the right extension to be using? Is there
another extension being developed?
Victor Vasiliev has been working on an extension called Scripting
which has a feature set closer to the plans we've been discussing at
WMF. I'm not sure what its level of maturity is. It uses my luasandbox
extension (/trunk/php/luasandbox) rather than shelling out.
Question 2) How to load external Lua code and make it
available?
Victor's code has a function called mw.importModule which may be of
some use.
I created an example of an info box generated from lua here:
http://lua.wikia.com/wiki/InfoboxLua However, it's clear that the
first thing you need is a template library. I can't figure out
how to load a third party lua library and make it available on a
page. This probably needs some kind of support in the extension
itself. For example:
http://lua.wikia.com/wiki/TestExpand?action=raw
Here I am using the lua loadstring() function to load/eval a
simple template library and attempting to execute it in the same
page. That doesn't work, although the same code works just fine
from the command line.
I don't think we will support loadstring(), instead all code will have
to be loaded via the module system.
-- Tim Starling