Types and calling conventions
Understand Lua values, method calls, indices, and native hashes.
Reference signatures below use documentation notation. Square brackets mean an optional trailing argument; they are not characters to enter in Lua code.
| Type or notation | Meaning |
|---|---|
boolean | Lua true or false. |
integer | An exact Lua integer. Player IDs and list indices have different ranges. |
number | A Lua numeric value; APIs that require finite values reject NaN and infinity. |
string | Lua byte string. Most UI/text APIs allow at most 4,096 bytes and no embedded zero byte. |
nil | No value; test optional player results before accessing fields. |
function(...) | Lua callback; it must return promptly. |
math.vec2 / math.vec3 | Value vectors with writable components, arithmetic, length, distance, dot and normalized-copy methods; global vec2/vec3 aliases remain. |
json.null | Explicit JSON null sentinel, retained inside arrays and objects. |
MenuPage | Page handle returned by menu.root() or page:submenu(). |
MenuControl | Control handle returned by the other page builders. |
Pointer | An owned-buffer or borrowed-address handle; see the memory reference. |
NativeValue | Opaque native argument wrapper created by natives.i64() or natives.f32(). |
RuleId | Integer returned when a script registers an incoming network filter. |
→ nothing | No useful return value. |
Type[] | Dense Lua sequence indexed from 1. |
Use dot syntax for namespace functions, for example util.log("Ready"). Use colon syntax for object methods, for example page:button(...) and pointer:read_u32(). Calling an object method with a dot requires explicitly supplying its receiver.
Rockstar IDs are returned as decimal strings to preserve precision. Native hashes are 64-bit identifiers: pass an exact Lua integer or a decimal/0x string where the API accepts one. A floating-point number is not a reliable representation of an arbitrary 64-bit identifier. A named native's Hash argument is a separate, unsigned 32-bit value, commonly produced by util.joaat().