Extension talk:Scribunto

Jump to navigation Jump to search

About this board

chcon: can't apply partial context to unlabeled file ‘lua’

AndyPKU (talkcontribs)

When I follow the manual instruction, and did "chcon -t httpd_sys_script_exec_t /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/yourOS/lua" this, it sais that can't aplly partial context to unlabeled file 'lua'. What should I do?

Dinoguy1000 (talkcontribs)

Did you change the system path as appropriate for your environment? The path shown on the page is only a sample and won't work verbatim unless you intentionally set up your server with that directory structure. Specifically, the /path/to/extensions refers to the /extensions directory in MediaWiki's base directory; on a default server this might therefore be /var/www/html/extensions. Additionally, the /yourOS directory is just an example and needs to be replaced as appropriate; check what directories are contained in /extensions/Scribunto/engines/LuaStandalone/binaries and select the correct one for the operating system your server is running.

AndyPKU (talkcontribs)

in fact, my lua is in the path /var/www/html/extension/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic,and I use the command CD into this directory and use command as chcon -t httpd_sys_script_exec_t lua, I am not sure whether it is suitable, but I take it for grunted.. (talkcontribs)

Same issue here.

Trying with chcon -t httpd_sys_script_exec_t /var/www/mediawiki/extensions/Scributon/engines/LuaStandalone/binaries/lua5_1_5_linux_32_generic/lua sends the same error my way.

I am trying to setup my wiki using a Raspberry Pi 3, using 32-bit Raspbian. (talkcontribs)

Have anybody resolved this problem? What was the reason?

Reply to "chcon: can't apply partial context to unlabeled file ‘lua’"

LuaSandboxFunction::call(): Unable to create timer: Invalid argument in Scribunto/includes/engines/LuaSandbox/Engine.php on line 318

2 (talkcontribs)

Getting a bunch of this warning at the top of any page with lua on it. Doesn't seem to actually affect lua from working, but it's not really usable with all the errors on the page, which I need to leave enabled for development. Couldn't find any results for this error. Running on debian 9 within WSL, which might be the cause?

Anomie (talkcontribs)

Probably WSL has an incomplete implementation of timer_create. LuaSandbox passes the clock ID fetched from pthread_getcpuclockid(pthread_self(), ...).

Reply to "LuaSandboxFunction::call(): Unable to create timer: Invalid argument in Scribunto/includes/engines/LuaSandbox/Engine.php on line 318"

Development environment for Scribuntu modules

Daask (talkcontribs)

I'd like to setup a basic development environment for testing Scribuntu modules locally on my computer. Right now, I'm directly editing the Module and then loading my Module/testcases page to see how it turned out. Testing it locally will dramatically speed up my development process. It's no trouble to install Lua itself (I'm on Ubuntu Linux), but Scribuntu uses a unique frame:getParent().args interface rather than conventional Lua arguments which makes switching back and forth from a regular Lua interpreter cumbersome. Has anyone setup a better development environment? Perhaps even just a helper function to turn a simple Lua invocation into a new object which implements the frame:getParent().args interface?

Mr. Stradivarius (talkcontribs)

There aren't any projects for doing anything like this, as far as I know. The only approaches I've used are editing on live websites, and editing on a full local MediaWiki installation with the Scribunto extension installed (using MediaWiki-Vagrant).

However, it is possible to pass in a fake frame object into the functions you are calling from your test cases; maybe that will be enough to let you run your test cases from standard Lua 5.1?

local frame = {getParent = function () return {args = {"first arg", "second arg", foo = "named arg"}} end}
local result = myFunction(frame)

There are a number of other differences from standard Lua in Scribunto as well; it would be a good idea to read up on those so that you know when to expect strange behaviour.

Reply to "Development environment for Scribuntu modules"
2600:1003:B45D:D34B:D4EB:D72B:9F2:C36E (talkcontribs)

I installed this extension so I would be able to install modules, but I can't figure out how to install them.

I followed the instructions on this page and the extension is working, but if I wanted to install something like the String module, do I just copy the script, save it as something.extension and upload it to my extensions/Scribunto/modules/ directory?

Even the "hello world" Bananas module doesn't say where or how to save it.

Mr. Stradivarius (talkcontribs)

You save them as pages on the wiki itself. To "install" the string module, copy it, edit the page "Module:String" on your wiki, paste the contents, and save the page. If the modules you install depend on any other modules, you will need to install those as well, or you may get errors. I'm not aware of any way to automatically find module dependencies like that - I usually just eyeball them for "require" statements.

2600:1003:B45D:D34B:D4EB:D72B:9F2:C36E (talkcontribs)

Thank you very much!

IcarusATB (talkcontribs)

Thank you very much for this topic! I couldn't find anywhere where this was explicitly stated.

This makes it so much more clear. Didn't realize a "Module:" was just like a "Template:" that you just save the page and it works itself out.  :P

IcarusATB (talk) 05:27, 10 April 2019 (UTC)

Reply to "Installing Modules" (talkcontribs)


I'm managing a wiki that had the Scribunto extension installed for some time but really wasn't used much except on a couple of test pages. I'm upgrading the wiki now (from 1.28 to 1.31) and have removed the Scribunto extension. However, when I run the scripts to populate the CirrusSearch index, I get the following traceback:


[7c132a3761cb626266d8cab6] [no req]   MWUnknownContentModelException from line 306 of /var/www/html/mediawiki-1.31.0/includes/content/ContentHandler.php: The content model 'Scribunto' is not registered on this wiki.

See https://www.mediawiki.org/wiki/Content_handlers to find out which extensions handle this content model.


#0 /var/www/html/mediawiki-1.31.0/includes/content/ContentHandler.php(243): ContentHandler::getForModelID(string)

#1 /var/www/html/mediawiki-1.31.0/includes/Title.php(4984): ContentHandler::getForTitle(Title)

#2 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(892): Title->getPageLanguage()

#3 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(2126): Parser->getTargetLanguage()

#4 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(2091): Parser->replaceInternalLinks2(string)

#5 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(1318): Parser->replaceInternalLinks(string)

#6 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(443): Parser->internalParse(string)

#7 /var/www/html/mediawiki-1.31.0/includes/content/WikitextContent.php(323): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)

#8 /var/www/html/mediawiki-1.31.0/includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)

#9 /var/www/html/mediawiki-1.31.0/includes/content/ContentHandler.php(1324): AbstractContent->getParserOutput(Title, integer, ParserOptions)

#10 /var/www/html/mediawiki-1.31.0/extensions/CirrusSearch/includes/Updater.php(363): ContentHandler->getParserOutputForIndexing(WikiPage, ParserCache)

#11 /var/www/html/mediawiki-1.31.0/extensions/CirrusSearch/includes/Updater.php(204): CirrusSearch\Updater->buildDocumentsForPages(array, integer)

#12 /var/www/html/mediawiki-1.31.0/extensions/CirrusSearch/maintenance/forceSearchIndex.php(218): CirrusSearch\Updater->updatePages(array, integer)

#13 /var/www/html/mediawiki-1.31.0/maintenance/doMaintenance.php(94): CirrusSearch\ForceSearchIndex->execute()

#14 /var/www/html/mediawiki-1.31.0/extensions/CirrusSearch/maintenance/forceSearchIndex.php(679): require_once(string)

#15 {main}


I found a few phabricator tickets that appear to be related but haven't yet found a workaround beyond reinstalling the Scribunto extension. Is there one? Is there a way to remove the Scribunto content model and/or references to it? (talkcontribs)

Additionally, I thought if I did an XML dump of all pages and revisions I would find a page using "<model>Scribunto</model>" but I don't seem to have any pages with that.

2620:11E:1000:120:1792:B56B:4655:6029 (talkcontribs)

Okay, I think I got it fixed. It turns out that if pages exist in the database in a namespace that mediawiki doesn't know about, there is no way to display them and they don't show up in an XML export either. I was able to reset the page content model of the single interfering page in the database like so:

UPDATE page SET page_content_model = 'wikitext' WHERE page_content_model = 'Scribunto'; (talkcontribs)

You are my hero; just had the exact same problem. Thank you _very_ much for posting the problem and the solution. I've never installed or run Scribunto, so never occurred to me to check for it.


Reply to "Uninstalling Scribunto"
Xinbenlv (talkcontribs)

Just curious, has anyone considered adding javascript / python to be supported by Scribunto?


Anomie (talkcontribs)
Reply to "Javascript support"

No Lua interpreter was given in the configuration, and no bundled binary exists for this platform.

9 (talkcontribs)

Hi. I need your help. When I try import infobox templates and Modules for my Wiki (mysite.com/wiki/Special:Import), then show this problem with Lua: "No Lua interpreter was given in the configuration, and no bundled binary exists for this platform."

Who know where is a problem? Thanks.

Legoktm (talkcontribs)

What operating system is your wiki running on? What version of MediaWiki? And did you change anything in your LocalSettings.php related to Scribunto? (talkcontribs)

System: Windows

MediaWiki version: 1.30.1.

I added to LocaSettings.php:

$wgScribuntoUseGeSHi = true;

$wgScribuntoUseCodeEditor = true;

wfLoadExtension( 'Scribunto' );

$wgScribuntoDefaultEngine = 'luastandalone';

and also this:

wfLoadExtension( 'ParserFunctions' );

$wgPFEnableStringFunctions = true;

wfLoadExtension( 'InputBox' );

wfLoadExtension( 'TemplateData' );

$wgUseInstantCommons = true;

wfLoadExtension( 'WikiEditor' );

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

wfLoadExtension( 'CodeEditor' );

$wgDefaultUserOptions['usebetatoolbar'] = 1; // user option provided by WikiEditor extension

Legoktm (talkcontribs)

Can you create a PHP script with the contents:


echo 'PHP_OS: ' . PHP_OS . "\n";
echo 'PHP_INT_SIZE: ' . PHP_INT_SIZE . "\n";

And then run it and provide the output? (talkcontribs)


Apn (talkcontribs)

I'm encountering the same issue under FreeBSD 11.2 + PHP7.2 + MW 1.32.0.

Error message when publishing an LUA module :

[6fa1dfb4611d587e0b74a32a] /mediawiki/index.php?title=Module:Fix&action=submit Scribunto_LuaInterpreterNotFoundError from line 200 of /usr/local/www/mediawiki/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneEngine.php: No Lua interpreter was given in the configuration, and no bundled binary exists for this platform.

Apn (talkcontribs)

As per the source code, this extension seems to be only supported on lua5_1_5_linux_32_generic, lua5_1_5_linux_64_generic, lua5_1_5_Win32_bin, lua5_1_5_Win64_bin, lua5_1_5_mac_lion_fat_generic.

Why is FreeBSD not supported anymore ?

Apn (talkcontribs)

As expected, it's perfectly supported under FreeBSD. You can apply this patch to make it work :


< if ( PHP_OS == 'Linux' ) {


> if ( PHP_OS == 'Linux' || PHP_OS == 'FreeBSD' ) {

Anomie (talkcontribs)

That'll work if your FreeBSD installation is configured to run Linux binaries.

Another alternative is to compile/install Lua 5.1 natively for FreeBSD, then set $wgScribuntoEngineConf['luastandalone']['luaPath'] in your LocalSettings.php to the path to your new Lua binary.

Reply to "No Lua interpreter was given in the configuration, and no bundled binary exists for this platform."

Lua Can't Access scribunto/includes

Summary by Legoktm

Resolved by question asker. (talkcontribs)

After much messing around and trying to get infoboxes to work, the imported page Template:Infobox on my wiki only gives me Lua exited with code 1. I looked into the lua error log and found this:

luastuff/luac53.exe: cannot open D:\xampp\htdocs\mywiki\extensions\Scribunto\includes: Permission denied

luastuffis my folder where I keep my lua binaries.

$wgScribuntoEngineConf['luastandalone']['luaPath'] = 'luastuff/luac53.exe';

$wgScribuntoEngineConf['luastandalone']['errorFile'] = 'luastuff/errorLog.txt';

How can I give the lua binary permissions to Scribunto/includes? (talkcontribs)

I also have just unchecked "Read-only." on the extension folder. I am on Windows 10 with a XAMPP Apache localhost. Still not working. Do I need to force something? (talkcontribs)

After another check, it seems like something is automatically setting the folder to read-only again. Why? (talkcontribs)

The issue persists after I disabled UAC, restarted, and replaced Lua 5.3 with Lua 5.1. (talkcontribs)

I fixed this a while ago by moving luastuff to the Scribunto folder.

Legoktm (talkcontribs)

Just for what it's worth, Scribunto intentionally uses lua5.1, and is not compatible with lua5.3.

Lua error in Module:Authority_control at line 779: attempt to index field 'wikibase' (a nil value).

Summary by Legoktm

Wikibase needed to be installed.

Jamiehutber (talkcontribs)
Dinoguy1000 (talkcontribs)
Jamiehutber (talkcontribs)

Thank you sir!

All fixed now.

Empty TemplateData and Lua script error

Hwgen22 (talkcontribs)

Recently, I have installed a MediaWiki instance locally on a virtual machine that I own. I have also installed VisualEditor, which is working fine.

As I and the future users of this wiki will need to insert references to document the web pages being written, I wanted to install the citation tool (https://www.mediawiki.org/wiki/VisualEditor/Citation_tool) to have something similar to what is being used on Wikipedia.

I have followed the steps carefully:

- I have installed Scribunto, ParserFunctions, Cite and TemplateData;

- I have imported some templates (e.g. Template:Cite_web) from Wikipedia, by using, respectively, the export and the import tools;

- I have specified the configuration message needed for the tool (MediaWiki:Visualeditor-cite-tool-definition.json).

When I use the VisualEditor tool, I see the "Cite" button and the different templates are listed. However, when I select any of the listed templates, no data appears (the template is empty).

In accordance with the troubleshooting part (https://www.mediawiki.org/wiki/VisualEditor/Citation_tool#Troubleshooting), I have tried to make a null edit the content of both the documentation page (e.g. Template:Cite_web) and the source page (e.g. Template:Cite_web/doc) by clicking on Edit then saving directly. This didn't help.

Also, I have tried to follow the different indications on this topic which deals with the same issue, but nothing worked so far.

This problem seems to be related to this bug (https://phabricator.wikimedia.org/T52372), however, the null edit does not resolve the issue.

The following API call is done when I try to open e.g. the web template from the Cite button:

"api.php?action=templatedata&format=json&titles=Template%3ACite web&lang=en&formatversion=2&doNotIgnoreMissingTitles=1&redirects=1"

Which results to this response:


  "batchcomplete": true,

  "warnings": {

  "main": {

     "warnings": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."


  "templatedata": {

     "warnings": "The parameter \"doNotIgnoreMissingTitles\" has been deprecated."



  "pages": {

  "23": {

     "title": "Template:Cite web",

     "notemplatedata": true,

     "params": []




Notice that when I click on "Cite" button, I select a template (e.g. Web) and I click on "Insert" even if the template is empty, a reference number is added in the text, but I have an error linked with Lua that is displayed.

Indeed, the file Module:Citation/CS1/styles.css has the following problem:

"Script error: Lua error at line 1: unexpected symbol near '/'."

The file, which comes from Wikipedia (https://en.wikipedia.org/wiki/Module:Citation/CS1/styles.css), has not been modified. By the way, if I remove all the comments, a similar error appears with the code.

Does anyone has any clue on this issue? I really need citation tool to work before adding any content on the wiki, otherwise it will be such a pain to manually add all the references or to update the pages a posteriori.


Operating system: Ubuntu 18.04.1 LTS

Server: Apache2

MediaWiki: 1.31.1 (590e94d)

PHP: 7.2.10

Lua: 5.1.5


VisualEditor: 0.1.0 (13a585a) - 5/30/2018

WikiEditor: 0.5.1 (277159c) - 5/5/2018

Cite: - (20e26df) - 4/17/2018

ParserFunctions: 1.6.0 (f2c63e5) - 10/15/2018

Scribunto: both the latest version for REL1_31 and (cdf41bb) - 11/22/2018

TemplateData: 0.1.2 (0cffe4a) - 10/15/2018

Bootstrap: 1.2.3

Anomie (talkcontribs)
Hwgen22 (talkcontribs)

Hi @Anomie,

Thank you for your response. I tried what you propose, but when I try to change the model of the page to "Sanitized CSS", MediaWiki aborts, giving me the following errors:

Invalid or unsupported value for property background at line 38 character 14.

Invalid or unsupported value for property background at line 44 character 14.

Invalid or unsupported value for property background at line 49 character 14.

The content of the file is exactly the same as the one hosted on Wikipedia (https://en.wikipedia.org/wiki/Module:Citation/CS1/styles.css).

And I still have this "Script error: Lua error at line1: unexpected symbol near '/'." on the page...

Do you know what I'm doing wrong?

Anomie (talkcontribs)

On Wikimedia sites the configuration is adjusted to (rather pointlessly, IMO) allow protocol-relative URLs to Commons images. You can either add "https:" to the URLs on those lines in your copy, or copy the changed configuration to your LocalSettings.php.

You're likely still getting the error because those invalid values prevented the content model change.

Hwgen22 (talkcontribs)

Thank you very much for your quick and useful response, @Anomie!

Now, I can effectively change the model of the page.

However, templates are still missing from the menu on VisualEditor.

When I insert a citation even if the template is missing, a new reference number is added but when I click on it, I have:

"Empty citation (help)<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>".

I don't understand, as the CSS file has now the mode "Sanitized CSS".

The only thing that, visually, is different from Module:Citation/CS1 is that on my imported page, I see things like:

"<section begin=header />", "<section end=header />", etc.

But I don't think that this is the problem causing all this mess.

I really don't know what to do now...

Anomie (talkcontribs)

It sounds like your remaining problems are with VisualEditor rather than Scribunto. You may want to ask on a talk page for that extension.

Hwgen22 (talkcontribs)

Ok I will ask for more help on the VisualEditor page. Thank you again for your help!

Hwgen22 (talkcontribs)

For those who will experience the same issue as me, it seems that waiting for jobs to complete is not sufficient, as if the tasks were frozen (or it takes a very long time). Each time I tried and waited, nothing happened.

Manually executing the job tasks will resolve the problems. To do so, run "php <path_to_wiki_installation>/maintenance/runJobs.php".

Note that for each template, you will still need to make a null edit on each template (e.g. Template:Cite_web).

Jamiehutber (talkcontribs)

Thanks guys. I'm having the exact same problem. I have changed the file type to "Sanitized CSS" however I am still seeing the same error interestingly on the pages using this Module:

Blanche was born into a working-class family in post-war England, and grew up on a Council estate during the 1950s,<ref name=Interview1>Page Module:Citation/CS1/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "Scribunto").</ref> a period he describes as 'grey and flat',<ref name=Ratspike>Page Module:Citation/CS1/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "Scribunto").</ref> and lacking in the visual richness available to modern youth. Instead he took early inspiration from cinema, his collections of toy soldiers, and producing drawings of historic warriors on the backs of old rolls of wallpaper.<ref name=Ratspike/>

During the 1960s Blanche was exposed to art and art movements, eventually attending art college, where he entered a course on the strength of his drawings and paintings of battle scenes and prehistoric conflicts,<ref name=Ratspike/> and where he recounts that he was told he "had a romantic spirit, but it would never earn me a living, so there was no point in doing it".<ref name=Interview1/>


Jamiehutber (talkcontribs)

Ah ok, you just need to resave the page :D

Reply to "Empty TemplateData and Lua script error"