Alloc
Allocate a block of memory inside the game process.
Syntax
Susano.Memory.Alloc(size, [protection]) -> integer | nil
Parameters
size (integer): Bytes to allocate (1 byte to 16 MB).
protection (string, optional): "rw" (default, read-write) or "r" (read-only). Executable memory is not exposed to Lua.
Return(s)
integer: Address of the allocated block, or nil on failure.
Behavior
Maximum 256 active allocations per Lua environment.
Allocations are tied to the owning Lua environment and are released automatically when that environment is destroyed.
Example(s)
local buf = Susano.Memory.Alloc(4096)
local roBuf = Susano.Memory.Alloc(256, "r")