# Options/Scribunto

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

## General

Enabled

Handles {{#invoke:Module:Module_name|Function_name|Arguments}}

- checked to process #invoke statements
- unchecked to render #invoke as text only

Lua engine

Select lua engine. See App/Xtn/Mediawiki/Scribunto#Engines

- 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)

## Lua options

Lua path

Path to Lua binary. Only applies to the `lua`engine.

Lua timeout

# of milliseconds before canceling Lua call

Lua timeout polling

# of milliseconds before checking for timeout. 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.

Lua timeout busy wait

# of milliseconds before entering timeout poll 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
- Video
- Download XOWA
- Download wikis

### Getting started

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

### Android

- Setup
- Video

### Help

- About
- Contents
- Media
- Feedback

### Blog

- Current

### Links

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

### Donate

- archive.org
- Wikipedia
- XOWA