Extension talk:Scribunto/Example extension

Hi

I was interested to do try the same socket extension in my privat wiki without success.

Did you arrange the extension to work on your wiki ?

Regards G


 * Hi! Sorry, I haven't had any luck.  I ended up getting frustrated with the lack of documentation and lack of response and just implementing the functionality I needed as a separate extension.  I guess Lua's useful if you want to write in something better than wiki markup, but for anything more complicated than loops and builtin string processing functions I guess you still have to go to PHP.

is the external function declaration in.
 * Hacking into  could help. You have to whitelist your lua library in   and include the C headers file: , which ought to be present in  , after you have installed the -dev package. Then, within   you have to register that library:

Unfortunately, this is not enough. When I remake luasandbox, I get error "undefined symbol luaopen_your_lib", although the .h file is successfully included and .so file is present in the system. So, something more has yet to be done. If this information helps you to load your library, please let me know how. Alex Mashin (talk) 14:55, 22 February 2014 (UTC) Alex Mashin (talk) 17:48, 22 February 2014 (UTC)
 * I managed to advance somewhat further. Instead of including, I downloaded source code for the lua library into luasandbox directory and included in   all C files from the library needed for successful compilation. Now luasandbox compiles and Scribunto works, but by the time   starts, the global Lua variable that should contain the library is nil and so it is in Scribunto modules.

Some comments on the extension
The idea of writing a MediaWiki extension in PHP to load a Lua C library seems wrong. If even it had worked it was likely to cause overhead by involving PHP. Anyway,  in Lua files will not work because global   is overloaded in. Alex Mashin (talk) 17:55, 22 February 2014 (UTC)