Skip to content

Lua Functions

  • PUBLISHED: 2024-2-8
  • UPDATED: 2024-2-10

Lua Reference Manual

https://www.lua.org/manual/5.4/

base

error
ipairs
next
pairs
print
select
tonumber
tostring
unpack
type

table

All standard Lua table library functions are available plus the following additions:

table.pack(...)

Returns a new sequential table created from the elements provided.

table.unpack(...)

Same as the Lua base library function unpack.


math

All standard Lua math library functions are available plus the following additions:

math.clamp(number, number, number)

Returns min(max(x, minVal), maxVal) where x is the first parameter and minVal and maxVal the second and third parameters.


string

All standard Lua string library functions are available.


bit32

since 1.1.7.154

Support for bitwise operations has been backported from Lua 5.2. All functions are available inside the table bit32.

Rectangle()                               -- [1]
Rectangle(rectangle)                      -- [2]
Rectangle(number, number)                 -- [3]
Rectangle(number, number, number, number) -- [4]

Returns a new rectangle with

  1. position and size set to (0,0).
  2. position and size copied from another Rectangle object.
  3. position set to (0,0) and size set to the two numbers.
  4. position set to the first pair of numbers and size set to the second two numbers.