# Options/Scribunto

From XOWA: the free, open-source, offline wiki application

Apps (basic) | Apps (advanced) | Wiki | HTML | External apps | Modules | Extensions | Misc

- Math
- Scribunto
- Score
- Wikibase

Save

## General

Enabled: [1] |
Lua engine: [2] |

## Lua options

Lua path: [3] |
The options below are for developer usage only.
Lua log enabled: [4] |
Lua timeout: [5] |
Lua timeout polling: [6] |
Lua timeout busy wait: [7] |

## Notes

1. ^ Handles {{#invoke:Module:Module_name|Function_name|Arguments}} (default is `checked`)
   - checked to process #invoke statements
   - unchecked to render #invoke as text only
2. ^ Select lua engine. See App/Xtn/Mediawiki/Scribunto/Overview#Engines (default is `luaj`)
   - luaj: lua code will be processed through the luaj jar at /bin/any/java/luaj/.
   - lua : lua code will be processed through the lua binary at /bin/os_name/lua/.
   Note for Lua engine users:
   - executable permissions: Linux / Mac OS X users may need to grant execute permission to the Lua binary. To ensure proper setup, please do the following:
     - Open Diagnostics/Scribunto/All
     - If the page fails, then see App/Xtn/Mediawiki/Scribunto#Permissions
   - NTFS partitions: Linux users with NTFS partitions will need to run a command like the following:
     `sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0000 /dev/whatever /mnt/whatever`
     See http://askubuntu.com/questions/11840/how-do-i-use-chmod-on-an-ntfs-or-fat32-partition (Thanks to Anselm)
3. ^ Path to Lua binary. Only applies to the `lua`engine.
4. ^ Choose one of the following (default is `unchecked`)
   - checked to output Lua send / recv statements to a log file (/xowa/user/anonymous/app/tmp/log)
   - unchecked to output nothing
5. ^ # of milliseconds before canceling Lua call (default is `4000`)
6. ^ # of milliseconds before checking for timeout. (default is `1`) For example, with a timeout of 4000:
     A timeout polling of 1 will check roughly 4000 times before timing out.
     A timeout polling of 1000 will check roughly 4 times before timing out.
   This setting should be left at 1. It is meant to "tweak" certain outlier situations should they arise.
7. ^ # of milliseconds before entering timeout poll (default is `250`) This setting should be left at 250 (or higher). It is also meant to "tweak" certain outlier situations.
   Background:
   - On Windows, a sleep call can take 15 ms. This could potentially cause each Lua call to take 15 ms.
   - Some pages / templates will call Lua hundreds of times. (For example: the Weather Box on http://en.wikipedia.org/wiki/Aruba or the Citations on http://en.wikipedia.org/wiki/Earth )
   - The busy wait is a primitive way to limit a wait to 1 ms (or less) before entering a more expensive sleep
   - A higher timeout busy wait value is more performant, but the disadvantage is that the UI will be locked up for longer
     For example, a busy wait of 250 means that the code will loop for 250 milliseconds before entering a sleep.
     For sub-second values, this freezing will be unnoticeable
   For reference, here is the corresponding code

       long time_bgn = System.currentTimeMillis();
       long time_woke = time_bgn;
       while (true) {
         byte[] rv = stream_read.Data();
         if (rv != null) return rv;
         long time_now = System.currentTimeMillis();
         if (time_now > time_woke + server_timeout_busy_wait) {
           if (time_now > time_bgn + server_timeout) throw Xoa_xtn_scribunto.err_("lua_timeout: timeout={0} cmd={1}", server_timeout, String_.new_utf8_(cmd_last));
           ThreadAdp_.Sleep(server_timeout_polling);
           time_woke = System.currentTimeMillis();
         }
       }

### XOWA

- Main page
- Screenshots
- Download XOWA
- Download wikis

### Getting started

- Requirements
- Installation
- Simple Wikipedia
- English Wikipedia
- Other Wikipedias

### Android

- Setup

### Help

- About
- Contents
- Media
- Feedback

### Blog

- Current

### Links

- Wikimedia dumps
- XOWA @ archive.org
- English Wikipedia

### Donate

- archive.org
- Wikipedia