client
The top level of the chunk runs once, at load; everything after that is an event. client registers those callbacks and gives you timing, logging and the signed-in user.
client.set_event_callback
Section titled “client.set_event_callback”client.set_event_callback(event: string, fn: fun(e: table))
| Argument | Type | Description |
|---|---|---|
| event | string | Event name. Base events are paint, shutdown, menu_open, menu_close; each game adds its own. |
| fn | function | Called with the event’s one table argument. |
Registers fn to run on event. An unknown event name raises an error.
client.unset_event_callback
Section titled “client.unset_event_callback”client.unset_event_callback(event: string, fn: function)
| Argument | Type | Description |
|---|---|---|
| event | string | Event name. |
| fn | function | The exact function previously registered. |
Removes a callback previously registered for event.
client.delay_call
Section titled “client.delay_call”client.delay_call(delay: number, fn: function[, ...])
| Argument | Type | Description |
|---|---|---|
| delay | number | Seconds from now. |
| fn | function | Called after delay seconds. |
| … | Arguments forwarded to fn. |
Runs fn on a later frame, delay seconds from now.
client.reload_active_scripts
Section titled “client.reload_active_scripts”client.reload_active_scripts()
Reloads every loaded script, this one included.
client.log
Section titled “client.log”client.log(...)
| Argument | Type | Description |
|---|---|---|
| … | Arguments, concatenated like print. |
Appends a line to the script console.
client.color_log
Section titled “client.color_log”client.color_log(r: integer, g: integer, b: integer, ...)
| Argument | Type | Description |
|---|---|---|
| r | integer | Red (0-255). |
| g | integer | Green (0-255). |
| b | integer | Blue (0-255). |
| … | The message, concatenated. |
Appends a coloured console line.
client.error_log
Section titled “client.error_log”client.error_log(...)
| Argument | Type | Description |
|---|---|---|
| … | The message, concatenated. |
Appends a red error line to the console.
client.screen_size
Section titled “client.screen_size”client.screen_size(): number, number
Returns the overlay width and height in pixels.
client.timestamp
Section titled “client.timestamp”client.timestamp(): number
Returns milliseconds on a high-precision monotonic clock, counted from process start.
client.unix_time
Section titled “client.unix_time”client.unix_time(): integer
Returns seconds since the Unix epoch.
client.system_time
Section titled “client.system_time”client.system_time(): integer, integer, integer, integer
Returns the local wall-clock time of day as hour, minute, second, millisecond.
client.random_int
Section titled “client.random_int”client.random_int(min: integer, max: integer): integer
| Argument | Type | Description |
|---|---|---|
| min | integer | Inclusive low bound. |
| max | integer | Inclusive high bound. |
Returns a uniform random integer in [min, max].
client.random_float
Section titled “client.random_float”client.random_float(min: number, max: number): number
| Argument | Type | Description |
|---|---|---|
| min | number | Low bound. |
| max | number | High bound (exclusive). |
Returns a uniform random number in [min, max).
client.get_lynx_user
Section titled “client.get_lynx_user”client.get_lynx_user(): table
Returns the signed-in Lynx user: username, uid, email, avatar, plan, and expires_at (Unix seconds, absent when the plan does not expire). A field is absent when unknown.
client.game
Section titled “client.game”client.game(): string
Returns the game key this build mods, e.g. "8ball_pool".
client.touch
Section titled “client.touch”client.touch(): number, number, boolean
Returns the current touch point as x, y, down.
client.tap
Section titled “client.tap”client.tap(x: number, y: number): boolean
| Argument | Type | Description |
|---|---|---|
| x | number | Overlay pixel x. |
| y | number | Overlay pixel y. |
Synthesises a tap at overlay pixel x, y. Needs the input capability. Returns whether the tap was sent.