User:Xenwolf/Lua

From Xenharmonic Wiki
Revision as of 20:41, 9 December 2020 by Xenwolf (talk | contribs) (rem newline)
Jump to navigation Jump to search

Lua is an easy to learn but powerful scripting language.

MediaWiki supports Modules written in Lua (by the extension Scribunto, bundled with 1.34+) which can simplify writing templates a lot. Especially in cases where a lot of calculations must be done efficiently or when loops are inevitable, Lua is the better choice (if not the only one).

Currently (Dec. 2020) Lua is evaluated on dev.xen.wiki, see dev:Category:Lua modules for examples.

Notes

in mw: Extension:Scribunto#Configuration there are some parameters to limit the impact/load of Lua scripts may have

  • memoryLimit - Specify the memory limit in bytes.
  • cpuLimit - Specify the CPU time limit in seconds.
  • profilerPeriod - Specify the time between polls in sections for the Lua profiler.
  • allowEnvFuncs - Set true to allow use of setfenv and getfenv in modules.

There is also an article about a PHP sandbox for Lua (currently not compatible with PHP8)

See also