Skip to main content

Global Variables

cx

The context object containing the current application state. See Context API for details.

plugin

The current plugin’s module table (available in plugin context).

Global Functions

Err(format, ...)

Create a custom error with formatted message.
string
required
Format string (printf-style)
any
Format arguments
Error
Custom error object

Helper Functions (from ya.lua)

These utility functions are available globally via the ya namespace:

ya.clamp(min, x, max)

Clamp a value between minimum and maximum.
number
required
Minimum value
number
required
Value to clamp
number
required
Maximum value
number
Clamped value

ya.list_merge(a, b)

Merge list b into list a (modifies a).
table
required
Target list
table
required
Source list
table
The modified list a

ya.dict_merge(a, b)

Merge dictionary b into dictionary a (modifies a).
table
required
Target dictionary
table
required
Source dictionary
table
The modified dictionary a

ya.readable_size(size)

Format byte size as human-readable string.
number
required
Size in bytes
string
Formatted size (e.g., “1.5M”, “3.2G”)

ya.readable_path(path)

Format path with ~ for home directory.
string
required
Absolute path
string
Path with ~ prefix if under home directory

ya.child_at(pos, children)

Find the child element at the given position.
table
required
Position {x, y} or Pos object
table
required
List of child elements with _area field
table|nil
The child element at the position, or nil

Environment Variables

Access environment variables using Lua’s os.getenv():

String Functions

Lua’s standard string library is available:

Table Functions

Lua’s standard table library is available:

Math Functions

Lua’s standard math library is available: