Basics
Globals
print, require, script, os and the standard libraries.
Every module in this documentation is a global table (agents, ui, combat...), there from the start. A few plain functions and tables come with them.
Writes a line to the Lua Console, in white, tagged with the plugin's name. Values are joined with tabs, as in standard Lua.
Writes a warning to the Lua Console, in amber.
Loads
name.lua (or name/init.lua) from the plugin's folder, once, and returns what it returned. Dots are folders: require("lib.util") loads lib/util.lua.spawn(fn, ...)integer
Starts a task. See Tasks and wait.
Pauses the current task. See Tasks and wait.
Stops a task.
script
About the plugin itself.
script.namestring
The plugin's name: its folder's name.
script.dirstring
The plugin's folder.
Stops the plugin after the current call returns.
Reloads the plugin after the current call returns: its files are read again and it starts over.
script.memory_used()integer
Bytes of memory the plugin uses now.
os
os.clock()number
Seconds since the plugin started.
os.time_ms()integer
The system clock, in milliseconds.
Standard libraries
The base functions (pairs, ipairs, pcall, error, tostring, setmetatable, load...) and the string, table, math, coroutine and utf8 libraries are there as in standard Lua. io, debug, dofile and loadfile aren't; use files to read and write files.