MEMORY
Alloc
Allocates a block of memory and returns its address.
Syntax
local address = ONYX.Memory.Alloc(size, protection)Parameters
size(integer) — Bytes to allocate (1 byte to 16 MB).protection(string (optional)) — "rw" (default) or "r" for read-only.
Return(s)
integer — address of the allocated block, or nil on failure.
Behavior
- Maximum 250 active allocations per Lua environment.
- Allocations are tied to the owning Lua environment and released automatically when it is destroyed.
Example(s)
local buf = ONYX.Memory.Alloc(4096)
local ro = ONYX.Memory.Alloc(256, "r")