Skip to content

API reference

URLCheck runs Lua 5.2. This section documents every function the sandbox provides, grouped by library, so you can look things up the same way you would in the Lua manual.

Page What is in it
_G The base library: assert, pairs, pcall, type, print, …
table table.concat, table.insert, table.sort, …
string string.find, string.gsub, string.format, Lua patterns, …
math math.floor, math.random, trigonometry, …
coroutine coroutine.create, coroutine.wrap, …
bit32 32-bit bitwise operations (Lua 5.2 has no bitwise operators).
Lua scripts Extra libraries: base64, json, http, js.

The reference page Lua scripts explains how a script is structured, what the u table contains and how URL encoding works. Lua script examples has complete scripts you can copy.

What is not available

The sandbox opens only the libraries above. These are not available, and a script that tries to use them gets a nil value:

  • os, io, debug, package, utf8 — no clocks, files, processes or module loading.
  • dofile, loadfile, require, module — a script cannot read or load other files.
  • unpack — use table.unpack instead (Lua 5.2 moved it there).

Language notes

Because the interpreter is Lua 5.2, a few newer things do not exist:

  • No // integer division. Use math.floor(a / b).
  • No bitwise operators (&, |, ~, <<, >>). Use the bit32 functions.
  • No utf8 library and no integer subtype: every number is a double.
  • goto and labels are available.
  • # (length), .. (concatenation), and/or/not, ==/~= and the usual control flow work as expected.
  • Strings are extended a little: s[i] reads one character and s + t concatenates as well as ... See string.

Everything runs in the sandbox described on Lua scripts: no direct file access, no network unless the script declares scriptNetwork and the setting is on, and each script has eight seconds per URL.