Extension talk:Scribunto

About this board

  • This page uses "Structured Discussions".
  • It has most recently started discussions at the top.
  • The page loads dynamically, meaning you can't tell how much more you will see when you scroll down

Lua error: Internal error: The interpreter has terminated with signal "24".

Summary by Reedy

$wgScribuntoEngineConf['luastandalone']['cpuLimit'] needed increasing.

Collabcollex (talkcontribs)


I'm hoping you can help me. I'm getting the following error on some pages with infoboxes:

'Lua error: Internal error: The interpreter has terminated with signal "24".
No further details are available.'

It only seems to happen on pages that contain more than 7 infoboxes. It doesn't seem to matter which infoboxes are present on the page. The first seven infoboxes are displayed, then there's an error message for each subsequent infobox that isn't displayed.

The wiki is running the latest version of MediaWiki and Scribunto.

Any help would be much appreciated!

Jackmcbarn (talkcontribs)

You set $wgScribuntoEngineConf['luastandalone']['cpuLimit'] too low. Either raise it or unset it.

Collabcollex (talkcontribs)

Thanks for responding so quickly!

It wasn't set, so I tried raising it and it's cleared the errors. Thanks again!

Lua error: Cannot create process: proc_open(/dev/null): failed to open stream:

Adrianevs (talkcontribs)

Hello Everyone,

I hard trying to setup correctly Scribunto but I get the following error:

Lua error: Cannot create process: proc_open(/dev/null): failed to open stream: Operation not permittedScript error: No such module "Check for unknown parameters". Script error: No such module "documentation".

And php debug:

Warning: proc_open(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/var/sentora/hostdata/zadmin/public_html/mydomain_com:/var/sentora/temp/) in /var/sentora/hostdata/zadmin/public_html/mydomain_com/extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php on line 267

Any idea how to fix that ?

Thanks in advance.

Legoktm (talkcontribs)

The problem itself is in the warning message: "open_basedir restriction in effect". You'll need to disable that. You'll need to talk to your hosting provider, it might be an option in the configuration panel.

Adrianevs (talkcontribs)

@Legoktm I run the mediawiki on a dedicated server. Any advice ?

Legoktm (talkcontribs)

You should edit your PHP configuration (php.ini) and disable the open_basedir restriction.

Deletedaccount4567435 (talkcontribs)

There is nothing set in my php.ini of CLI. But still got same error. What should I do?

Using 2G ram server.

Reply to "Lua error: Cannot create process: proc_open(/dev/null): failed to open stream:"

Enable proc_open in the php.ini file

2 (talkcontribs)

Hi There,

To implement this extension, proc_open must be enabled in the php.ini file.

Due to security issues we are not allowed to enable this option.

So my following questions:

  1. Is there any other way implementing this extension without activating this option?
  2. Is there an Alternative for Scribunto?

Thanks and regards


Anomie (talkcontribs)
Reply to "Enable proc_open in the php.ini file"
Nicolas senechal (talkcontribs)

I don't have any error in my luaerror, but it's like something go wrong,

in the template:notice I have some non-translated lua like {{#if:|{{{titre}}}}} in the wikicode I have this |texte = {{#if:{{{titre|}}}|'''{{{titre}}}'''}} So here is some lua return when I import notice :

RX <== registerLibrary

TX ==> return

RX <== loadString

TX ==> return

RX <== call

TX ==> return

RX <== registerLibrary

TX ==> return

RX <== cleanupChunks

TX ==> return

RX <== loadString

TX ==> return

RX <== call

TX ==> return

RX <== cleanupChunks

TX ==> return

RX <== call

TX ==> call

RX <== loadString

TX ==> return

RX <== return

TX ==> return

RX <== registerLibrary

TX ==> return

RX <== cleanupChunks

TX ==> return

Nicolas senechal (talkcontribs)

Ok, it's not say but to import some wikipedia tamplate (like notice) you need Extension:ParserFunctions, but now I don't have exactly the same notice as wikimedia, I don't have the headband(if my transalte is correct in french we say beaudeau...) so how can I have the headband?

Tacsipacsi (talkcontribs)
Nicolas senechal (talkcontribs)

Exactly, before they just not appear, but now with your help (I just import Module:Message box because I have already Extension:TemplateStyles). But now I have another error in lua :

Lua error : Module:TNT:158: '''Missing JsonConfig extension, or not properly configured; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Documentation.tab. See https://www.mediawiki.org/wiki/Extension:JsonConfig#Supporting_Wikimedia_templates'''.

So I install Extension:JsonConfig - MediaWiki but I don't know how to "properly configured" it.

Someone can help me please?

Reply to "lua don't translate {{#if:"

LuaError : The syntax for the file, directory, or volume name is incorrect.

2 (talkcontribs)

I have a lua error for all notice implementation (except css) in my luarror.log I got this message in my log :

The syntax for the file, directory, or volume name is incorrect.

I check every article and except for the css article all have errors (like 1 or 3).

so here is my configuration for scribunto :

wfLoadExtension( 'Scribunto' );

$wgScribuntoEngineConf['luastandalone']['luaPath'] = 'C:\xampp\htdocs\mediaWikiTest\mediawiki-1.37.1\extensions\Scribunto\includes\engines\LuaStandalone\binaries\lua5_1_5_Win64_bin\lua5.1.exe';

$wgScribuntoDefaultEngine = 'luastandalone';

$wgScribuntoEngineConf['luastandalone']['errorFile'] = 'C:\xampp\htdocs\mediaWikiTest\mediawiki-1.37.1\extensions\Scribunto\luaError.log'; (talkcontribs)

OK my bad, I am dump so ignore this I resolved it, I don't know how to read documentation...

Content handler not working on old wiki

GreenReaper (talkcontribs)

I have an old wiki farm running MediaWiki 1.23 - we have an appropriate version of this extension working as far as I can tell, using LuaJIT, but one part doesn't seem to be working - the page content handler isn't processed even though the content model is set correctly (shows up as 'Scribunto' in JS), and the end result is that Module: pages are displayed as one line of text, without formatting, even though in the source you can see it formatted.

Has anyone else encountered this? Perhaps it could be a known [old] issue interacting with another extension, of which we have many? (I don't fully understand the code, but it seems to be trying to override the parser, and there's probably other stuff doing that too.)

Obviously upgrading to MW 1.35+ is a target of ours, but it will take some time to prepare and we have people who want to work on importing Wikipedia's Lua-dependent templates.

FeRDNYC (talkcontribs)

Mmm, I see what you mean.

Shot in the dark, but one difference I note, when comparing your wiki's Special:Version (my word that's a lot of extensions!) and enwiki's is the lack of a Pygments version (in the "Installed software" block at the very beginning). Since I would expect Pygments to be involved in syntax-highlighting the code listing, I wonder if perhaps that's part of the issue? (Does content using the CSS or JS model show up with correct formatting?)

GreenReaper (talkcontribs)

Nice idea, but in fact the reason you don't see Pygments is that SyntaxHighlighter only switched over to that in 2015, for REL1_26, whereas we're on REL1_23.

SyntaxHighlight lang="lua" works as well, on a normal page. The CSS/JS functionality seems to require TemplateStyles, which I believe only became available in MW 1.27 (at least, that is the first branch in its repo). However, CSS is available as a SyntaxHighlight language and works. It seems to be just not hooking in.

FeRDNYC (talkcontribs)

Ah, didn't realize Pygments support was that "new"!

When I asked about CSS or JS, I was referring to the display of pages like wikifur:MediaWiki:Common.css and wikifur:MediaWiki:Common.js, to verify that they _were_ formatting properly. But I see that they are, so we can reasonably expect Module-namespace pages to, as well.

(Ah, right, syntax highlighting used GeSHi back then! As the HTML source for https://en.wikifur.com/wiki/MediaWiki:Common.css just reminded me.)

This feels like a PHP issue, to me. Seems like Scrbunto/includes/common/ScribuntoContent.php (assuming it was at the same path, way back when) isn't being run, despite the content model being correctly set on the page. I'd recommend trying the steps in Manual:How to debug for enabling PHP errors and extra logging, see if you can figure out why the extension isn't formatting the code.

GreenReaper (talkcontribs)

I'm confused, too, though I'm sure there's a perfectly logical explanation, possibly linked to our esoteric wiki-farm setup with shared code. I did get debug comments working, and it looks like it knows what the right handler is:

[caches] main: APCBagOStuff, message: APCBagOStuff, parser: APCBagOStuff
[caches] LocalisationCache: using store LCStoreCDB
Unstubbing $wgParser on call of $wgParser::setHook from ExtDynamicPageList::setupDPL
Parser: using preprocessor: Preprocessor_DOM
LocalisationCache::isExpired(en): cache for en expired due to GlobalDependency
LocalisationCache::recache: got localisation for en from source
Connected to database 0 at localhost
DatabaseBase::query: Writes done: DELETE FROM `msg_resource`
Fully initialised
Title::getRestrictionTypes: applicable restrictions to [[Module:Arguments]] are {edit,move}
[ContentHandler] Created handler for Scribunto: ScribuntoContentHandler
IP: x.x.x.x
MessageCache::load: Loading en... got from global cache
Article::view using parser cache: no
Article::view: doing uncached parse
Unstubbing $wgLang on call of $wgLang::getDatePreferenceMigrationMap from User::getDatePreference
Title::getRestrictionTypes: applicable restrictions to [[Module:Arguments]] are {edit,move}

I tried taking out all the extensions that unstubbed $wgParser early, as that's been an issue before [DPL, nicecategorylist, stubmanager, piclens, randominclude], but it didn't have any obvious impact beyond the relevant message.

FeRDNYC (talkcontribs)

Yeah, that's really all I've been able to come up with so far. I realize it isn't very helpful, sorry about that. Perhaps someone else with a better memory of older MW configs will turn up, and be able to provide more information.

Reply to "Content handler not working on old wiki"

The content model 'sanitized-css' is not registered on this wiki.

Nicolas senechal (talkcontribs)

I try to import the notice tamplate from Wikipedia, I work on xampp on windows. So I install scribunto and lua on my wiki and when I went to import notice I have this error(I did a little translation from French to English) :

import error : The content model 'sanitized-css' is not registered on this wiki

So I have my template but no Css and documentation don't work.

maybe it's a lua error, in that case it's an installation error (because I don't quite understand the full installation on windows so I have a lua dll in my php...)

Any help is appreciated.

Dylsss (talkcontribs)
Nicolas senechal (talkcontribs)

Thank you @Dylsss it works well, now I have a lua error.

Erreur de script : Erreur Lua : erreur interne : l’interpréteur s’est arrêté avec l’état « 1 »

translate :

script error : lua error : intern error : the interpreter stop with stat «1»

So if someone can give me a good doc to download lua on XAMPP on windows I take. Because I think just to put the dll is not enough...

FeRDNYC (talkcontribs)

@Nicolas senechal: If you're trying to use luaSandbox, check my comments in this discussion for information about setting it up. I imagine that process should be almost the same for xampp as for IIS, since you're installing Lua into PHP as an extension.

FeRDNYC (talkcontribs)

Also, make sure you installed a Lua 5.1 DLL — newer versions are NOT compatible.

Nicolas senechal (talkcontribs)

Thank you, I don’t quite understand this technical part ‘or in the directory above it where the PHP binary lives.’ I dosen't find the php binary location… and scribunto don’t find the path to lua so I set this:

wfLoadExtension( 'Scribunto' );

$wgScribuntoEngineConf['luasandbox']['luaPath'] = 'C:\xampp\php\ext\php_luasandbox.dll';

$wgScribuntoDefaultEngine = 'luasandbox';

And in the import page when I went to import I have this error :

import failure : The luasandbox extension is not present, this engine cannot be used.

It doesn't work (maybe because of my bad?)

FeRDNYC (talkcontribs)

By "the directory above it where the PHP binary lives" I simply meant the directory C:\Program Files\PHP\v8.0\, the parent directory of the extension folder C:\Program Files\PHP\v8.0\ext\. Since one of the default load paths for DLLs is the same directory as the executable file loading them, and since the actual php.exe binary is located in that directory (the parent), it seemed like a good idea to place the lua DLL in there as well. (But I also dropped it into the extension directory, so I was covered either way.)

I think what you're missing is to have PHP itself load the luasandbox extension. You need to add a line to your php.exe file php.ini file telling it to load the extension:


That'll tell PHP to load the file php_luasandbox.dll, which you should've placed in your PHP installation's ext directory.

FeRDNYC (talkcontribs)

You need to add a line to your php.exe file

Sorry, I meant php.ini file.

FeRDNYC (talkcontribs)

@Nicolas senechal: Also, you definitely don't want this line:

$wgScribuntoEngineConf['luasandbox']['luaPath'] = 'C:\xampp\php\ext\php_luasandbox.dll';

I mean, I don't think it'll do any harm, but at best it's a useless statement that will be ignored, at worst it might cause some sort of actual problem. The sandboxed interpreter extension has to be loaded by php.exe at startup, which is why it's installed by editing php.ini instead of the MediaWiki configuration.

FeRDNYC (talkcontribs)

(If anything, I think you'd want to set luaPath to the location of lua5.1.dll, instead — but that shouldn't be necessary. It'll work without any configs as long as the php_luasandbox.dll module can find the interpreter, and if it can't then setting the path in the MediaWiki configuration is unlikely to solve the problem.)

Nicolas senechal (talkcontribs)

Thank you very much , so I have lua5.1.dll at ext and in it parent directory(it was my last configuration...) I have luasandbox.dll in ext and I put in php.ini line (I did it again in the past...) but I try to launch ph.exe and I know the problem now but not the solution.

PHP Warning:  PHP Startup: Unable to load dynamic library 'php_luasandbox.dll' (tried: C:\xampp\php\ext\php_luasandbox.dll (Le module sp├®cifi├® est introuvable), C:\xampp\php\ext\php_php_luasandbox.dll.dll (Le module sp├®cifi├® est introuvable)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'php_luasandbox.dll' (tried: C:\xampp\php\ext\php_luasandbox.dll (Le module sp├®cifi├® est introuvable), C:\xampp\php\ext\php_php_luasandbox.dll.dll (Le module sp├®cifi├® est introuvable)) in Unknown on line 0

He can't find cifi module, what is it, how can make it find?

FeRDNYC (talkcontribs)

Hmm, I'm not sure — that's an error I haven't personally hit, to be honest. I also can't seem to find any information about a "cifi" module on the internet... is that error message a direct cut-and-paste, or did you retype it? Is it possible it was the 'cffi' module that was referenced? (That one, at least, I have heard of.)

It sounds to me like you might not have all of the pieces of the lua extension installed, or you might have the wrong luaSandbox extension installed. My reading online is that the Apache version of PHP (which I assume is what's used in XAMPP) uses thread-safe extensions, unlike the versions installed for IIS which use non-thread-safe.

The only time I've seen a message anything like the one you provided is when I didn't have lua5.1.dll installed in the correct location. (I've now conclusively determined that it must be installed in the same directory as php.exe, not the extension directory. So, in your setup, it should be located at C:\xampp\php\lua5.1.dll.) Otherwise, with my PHP installation, starting PHP with the extension enabled will output this similar error message:

> C:\tools\php81\php.exe -a
PHP Warning:  PHP Startup: Unable to load dynamic library 'luasandbox' (tried: ext\luasandbox (The specified module could not be found), ext\php_luasandbox.dll (The specified module could not be found)) in Unknown on line 0
Interactive shell

php >

Once I copied lua5.1.dll to C:\tools\php81\lua5.1.dll, that error message went away and I was able to use the example code provided here to test the Lua sandbox implementation without even involving MediaWiki (until I knew it was working).

Nicolas senechal (talkcontribs)

Thank you very much for your patient and for your help. The problem is a copy past, so maybe a bad translates of php because cifi is not a frensh word. So it can be possible it's cffi.

Now I am in thread-safe dll.

I try to put lua5.1 in the parent file and it doesn’t work.

I shear in phpinfo if don't miss something and I find an old reference in PHP Variables $_SERVER['PATH'] and in the environment Path I have this path C:\Program Files (x86)\WinLua\Lua\5.3\bin\; I uninstall winlua and it is still in the php configuration, so I uninstall xampp and install it again. The line still here... maybe here we have the error so how can I really unstall it?

I have already an error, I remove lua5.1 from C:\xampp\php and I don't have an error in php.exe. And when lua5.A is in C:\xampp\php I have the same result.

SO my actualle configuration it'sphp 8.1.2 I have the line extension=php_luasandbox.dll in php.ini , I have C:\xampp\php\ext\php_luasandbox.dll and C:\xampp\php\lua5.1.dll

I try the example code (I don't think it's coding errors) but I have this error.

Fatal error: Uncaught Error: Class "LuaSandbox" not found in C:\xampp\htdocs\mediaWikiTest\infoPHP.php:8 Stack trace: #0 {main} thrown in C:\xampp\htdocs\mediaWikiTest\infoPHP.php on line 8

contenue de infoPhp.php

<?php //GET info php

echo "pcre: " . ( extension_loaded( "pcre" ) ? PCRE_VERSION : "no" ) . "\n";

echo "pcntl: " . ( extension_loaded( "pcntl" ) ? "yes" : "no" ) . "\n";

echo "mbstring: " . ( extension_loaded( "mbstring" ) ? "yes" : "no" ) . "\n";


echo "=============================luaTest==============================\n";//code from https://www.php.net/manual/en/luasandbox.examples-basic.php

$sandbox = new LuaSandbox;

$sandbox->setMemoryLimit( 50 * 1024 * 1024 );

$sandbox->setCPULimit( 10 );

// Register some functions in the Lua environment

function frobnosticate( $v ) {

    return [ $v + 42 ];


$sandbox->registerLibrary( 'php', [

    'frobnosticate' => 'frobnosticate',

    'output' => function ( $string ) {

        echo "$string\n";


    'error' => function () {

        throw new LuaSandboxRuntimeError( "Something is wrong" );


] );

// Execute some Lua code, including callbacks into PHP and into Lua

$luaCode = <<<EOF

php.output( "Hello, world" );

return "Hi", function ( v )

    return php.frobnosticate( v + 200 )



list( $hi, $frob ) = $sandbox->loadString( $luaCode )->call();

assert( $frob->call( 4000 ) === [ 4242 ] );

// PHP-thrown LuaSandboxRuntimeError exceptions can be caught inside Lua

list( $ok, $message ) = $sandbox->loadString( 'return pcall( php.error )' )->call();

assert( !$ok );

assert( $message === 'Something is wrong' );


And I try with littel hopes to run with mediawiki and when I import the tamplate notice I have this error : Échec de l’importation : The luasandbox extension is not present, this engine cannot be used.

Translation of French part : import failed : ....

It's like it doesn’t exist.

Reply to "The content model 'sanitized-css' is not registered on this wiki."

Lua error: bad argument #1 to "get" (not a valid title).

Wsdmatty (talkcontribs)

I have recently begun a quest to import Template:Quote to my wiki. This was not straightforward and took a lot more time than I anticipated. However, through trial and error and muddling my way through extension installations, I have finally got the template working.

However, Template:Documentation is giving me a Lua error. I don't know if it's mental fatigue or my brain has just given up, but i can't figure out what the actual problem is. Any suggestions would be greatly appreciated.


Lua error: bad argument #1 to "get" (not a valid title).


  1. (tail call): ?
  2. [C]: in function "error"
  3. MWServer.lua:81: ?
  4. (tail call): ?
  5. (tail call): ?
  6. Module:TNT:162: in function "loadData"
  7. Module:TNT:181: ?
  8. (tail call): ?
  9. (tail call): ?
  10. Module:Documentation/config:63: in function "init"
  11. package.lua:103: ?
  12. (tail call): ?
  13. mw.lua:486: in function "executeModule"
  14. mw.lua:762: in function "loadData"
  15. Module:Documentation:8: in function "chunk"
  16. mw.lua:486: ?
  17. (tail call): ?
  18. [C]: in function "xpcall"
  19. MWServer.lua:99: in function "handleCall"
  20. MWServer.lua:313: in function "dispatch"
  21. MWServer.lua:70: ?
  22. (tail call): ?
  23. (tail call): ?
  24. (tail call): ?
  25. mw.lua:511: ?
  26. (tail call): ?
  27. [C]: in function "xpcall"
  28. MWServer.lua:99: in function "handleCall"
  29. MWServer.lua:313: in function "dispatch"
  30. MWServer.lua:52: in function "execute"
  31. mw_main.lua:7: in main chunk
  32. [C]: ?

Tacsipacsi (talkcontribs)

Did you set JsonConfig up? The relevant parts from Wikimedia’s CommonSettings.php are:

// Safety: before extension.json, these values were initialized by JsonConfig.php
if ( !isset( $wgJsonConfigModels ) ) {
	$wgJsonConfigModels = [];
if ( !isset( $wgJsonConfigs ) ) {
	$wgJsonConfigs = [];

$wgJsonConfigEnableLuaSupport = true;

// https://www.mediawiki.org/wiki/Extension:JsonConfig#Configuration

$wgJsonConfigModels['Tabular.JsonConfig'] = 'JsonConfig\JCTabularContent';
$wgJsonConfigs['Tabular.JsonConfig'] = [
	'namespace' => 486,
	'nsName' => 'Data',
	// page name must end in ".tab", and contain at least one symbol
	'pattern' => '/.\.tab$/',
	'license' => 'CC0-1.0',
	'isLocal' => false,

// Enable Tabular data namespace on Commons - T148745
$wgJsonConfigInterwikiPrefix = 'commons';
$wgJsonConfigs['Tabular.JsonConfig']['remote'] = [
	'url' => 'https://commons.wikimedia.org/w/api.php'
Wsdmatty (talkcontribs)

Thank you very much for this. I had not set it up properly but this fixed my problem.

Odoxo (talkcontribs)

This took me an age to figure out, should be more prominent in the JsonConfig help section - thank you!

Sachinpatel393 (talkcontribs)

after copy above settings in localsettings.php

now getting this error:

Lua error in Module:Documentation at line 137: message: type error in message cfg.main-div-classes (string expected, got nil).

IBikette (talkcontribs)


My wiki is on a private network and have not access to Internet.

I set JsonConfig up. There is my config...

// --------------------------------------------------------------------------------

wfLoadExtension( 'JsonConfig' );

$wgJsonConfigModels['Tabular.JsonConfig'] = 'JsonConfig\JCTabularContent';

$wgJsonConfigs['Tabular.JsonConfig'] = array(

        'namespace' => 486,

        'nsName' => 'Data',

        #'nsName' => false,

        #'isLocal' => false,

        'isLocal' => true,

        #'store' => true,

        'pattern' => '/.\.tab$/'


// --------------------------------------------------------------------------------

And I have some problems (errors Lua) in some module, about wikibase, wikidata...

Should you Have some tips for me ?

Thank you!

Reply to "Lua error: bad argument #1 to "get" (not a valid title)."

'""C:\xampp\htdocs\mediawiki\extensions\Scribunto\includes\engines\LuaStandalone' is not recognized as an internal or external command, operable program or batch file.

Bradeblo3 (talkcontribs)

I want to import infoboxes from wikipedia into my wiki, i used Manual:Importing Wikipedia infoboxes tutorial to help me do it as I am a very new beginner at MediaWiki and programming in general. Everything was going well, although I couldnt install WikiBase for some reason, it seemed beyond my ability at the moment, I decided to do it later. I imported a lot of wikipedia templates and modules, but the pages in my wiki had this error:

Lua error: Internal error: The interpreter exited with status 1.

I went on the Scribunto wiki and created a log for the error:

'""C:\xampp\htdocs\mediawiki\extensions\Scribunto\includes\engines\LuaStandalone' is not recognized as an internal or external command, operable program or batch file.

Looks a bit weird with the five quotations, not sure if thats the issue. I've been trying to get wikipedia's infobox on my wiki all day now, help is appreciated!

FeRDNYC (talkcontribs)

I agree, the error does appear strange. It's actually only a pair of leading double quotes (the single quote corresponds to the one following "LuaStandalone", it's just part of the error message), but still that's likely an issue.

As the page tutorial you followed mentions, importing current modules will only work if you first have successfully installed Scribunto (I have no idea why that's bold text, and not a link somewhere useful). First question is — have you? If Scribunto isn't working generally, the imports won't work, and no amount of importing templates/modules can make Scribunto work. That's specific to your OS, webserver, and other environmental factors unique to the installation.

One option for running Scribunto on Windows is the luaSandbox interpreter — see this discussion for information on both the benefits and pitfalls of that approach. Note, though, that my post there is primarily focused on IIS... with xampp, at least in theory running luaStandalone should be an easier proposition.

But I would recommend approaching the problem from a "prepare the environment to receive my imports first" stance. Don't even worry about importing anything (or getting what you've imported working) until you have a Module namespace and can create and successfully execute a piece of [[Module:HelloWorld]] type Lua code. Because you know the imported pages can't work without a functional Scribunto.

If you still can't get Lua working at all, please update with the relevant sections of your localSettings.php config, and any other configuration changes you've made up to that point, as well as any relevant values you intentionally omitted / left at their default values.

Reply to "'""C:\xampp\htdocs\mediawiki\extensions\Scribunto\includes\engines\LuaStandalone' is not recognized as an internal or external command, operable program or batch file."
Squeak24 (talkcontribs)


I was wondering if it is possible to use the XML2LUA plugin to convert XML content into Lua, which can then in turn display XML content into Scribuntu.

I have tried to install XML2LUA into the Standalone Lua, the 64bit version on my Windows Server 2012. But when I run luarocks make, it doesn't install.

Is this possible, or should I give up?

Any help is appreciated.


FeRDNYC (talkcontribs)

@Squeak24 : It might be possible, with a lot of work, but it's not trivially possible. You can't import arbitrary Lua modules into the Scribunto environment.

For starters, it doesn't support filesystem access at all — the require statement "Can fetch certain built-in modules distributed with Scribunto, as well as modules present in the Module namespace of the wiki. To fetch wiki modules, use the full page name including the namespace. Cannot otherwise access the local filesystem."

The Lua standard library modules that are available are only present because they've been explicitly wrapped into the sandboxed Lua environment by the Scribunto setup code. At runtime, as the quote above notes, the only namespace accessible to Module code is the rest of the Module namespace on-wiki.

That being said, the fact that xml2lua is a pure-Lua package does mean that there are some options open to you. First off, you'd have to get a copy of the package itself — luarocks is unusable in the Scribunto environment because it uses local filesystem access to download and install packages. You could get a copy of the module from the author's Github repo at manoelcampos/xml2lua, but even then you need luarocks to build it into a loadable package.

I'm on Fedora Linux, which distributes lua-5.4, and its luarocks package is configured to use that environment by default. But Fedora's compat-lua package provides a legacy lua-5.1 build. After installing that, I created an /etc/luarocks/config-5.1.lua configuration using the existing /etc/luarocks/config-5.4.lua file as a guide, and with that in place I was able to run luarocks --local --lua-version=5.1 install xml2lua to get a copy of the package installed into $HOME/.luarocks/share/lua/5.1/.

Now, this is where it being a pure Lua package helps, because we know that the package doesn't contain any C-library calls, which the sandbox environment doesn't support. Hopefully there are no filesystem accesses or other invalid code either. I haven't looked, to be honest, you'll have to do that part of the investigation if you're interested in trying to make this work.

Because the package is pure Lua code, there are two possibilities for making it available in Scribunto:

  1. You could hack xml2lua into the Scribunto environment as a Lua library package exported into the sandbox. That'd involve at the very least...
    1. Editing the Scribunto/includes/engines/LuaStandalone/MWServer.lua code and adding the pieces of xml2lua to the allowedGlobals object in MWServer:newEnvironment. (You'll see where tables and math are already listed as allowed global libraries.)
    2. (I think...) Modifying Scribunto/includes/engines/LuaCommon/lualib/package.lua and adding the pieces of xml2lua as package.loaded.module.
    3. Possibly having to write some wrapper PHP code in Scribunto/includes/engines/LuaCommon/, to wire up the functions made available by the xml2lua modules.
    4. Doing a lot of finger-crossing, along with some finding of religion and/or ritual sacrifice, as appropriate.
  2. You could import the library's modules into your wiki as Module:-namespace pages that run under the Scribunto environment. (IMHO, the far more sane option, though it's still a big "may or may not work" hail-Mary.) To do that, you'd...
    1. Create a new Module: namespace page for each of the xml2lua library's .lua files, and paste in the code.
    2. Edit the code so that (for instance) when Module:xml2lua loads its parser module, instead of using local XmlParser = require("XmlParser") as the original xml2lua.lua file does, it uses local XmlParser = require("Module:XmlParser") to load your imported copy of the code (which you naturally created by pasting in the contents of XmlParser.lua).
    3. Sanitize the rest of the code to remove any problem Lua code that may be in there; I can't even begin to guess what might constitute problem Lua code, but the sandbox's parser will tell you pretty quick once you've pasted it into the editor and tried to run it.
    4. Do a lot of the same finger-crossing, prayer-and-or-ritual-sacrifice stuff, probably.

Is it worth it? Only you can decide that. But it might actually be an interesting challenge, and completely permissible under the terms of the package's MIT license.

Reply to "XML2LUA"
Return to "Scribunto" page.