From XOWA: the free, open-source, offline wiki application
General
Lua options
Notes
-
^ Handles {{#invoke:Module:Module_name|Function_name|Arguments}} (default is
checked
)
-
checked to process #invoke statements
-
unchecked to render #invoke as text only
-
^ 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:
-
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)
-
^ Path to Lua binary. Only applies to the
lua
engine.
-
^ 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
-
^ # of milliseconds before canceling Lua call (default is
4000
)
-
^ # 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.
-
^ # 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();
}
}