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?

Question 2) How to load external Lua code and make it available?  

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 originally tried with a template like loadstring('{{Expand.Lua}}' and the 
template actually expands properly but runs into the same problem.  The 
function created by load string is not actually executable.   I'm not sure if 
it's a sandboxing issue or something else yet, I haven't had time to 
investigate.   There's also a loadfile() function but that reads off the local 
file system.  I suppose I could add things to the local lua include path and 
load them that way, but it seems better to have a self contained 100% wiki 
based solution there.

Has anybody gotten that far, or farther with Lua?  I'm happy to hack on the 
extension a little bit if that's the proper solution here.

Owen

On Feb 1, 2012, at 3:51 PM, MZMcBride wrote:

> Tim Starling wrote:
>> On 29/01/12 09:51, Platonides wrote:
>>> Doesn't seem to have arrived into the list. Resending.
>>> 
>>> On 27/01/12 16:17, Platonides wrote:
>>>> 1) Is there a simple Lua syntax guide?
>>>> http://www.lua.org/manual/5.2/ looks more like a grammar. Certainly
>>>> not suitable for end users.
>> 
>> Yes, the first edition of Programming in Lua is available online:
>> 
>> http://www.lua.org/pil/
> 
> Thanks for this. I've added this link to (the brand new)
> <https://www.mediawiki.org/wiki/Lua/Resources>.
> 
> I also un-redirected <https://www.mediawiki.org/wiki/Lua> and fleshed it out
> a bit.
> 
> MZMcBride
> 
> 
> 
> _______________________________________________
> Wikitech-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l


_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to