Raw packets & Child instances
Raw packets
client:send(name, params?)
| Field | Type |
|---|---|
| Signature | (self: Client, name: string, params: {[string]: any}?) → string? |
| Returns | string? — nil on success |
| Common errors | Errors.DISCONNECTED |
| Async | yes |
Sends an arbitrary BSON packet by id. params becomes the envelope body.
client:on(event, callback)
| Field | Type |
|---|---|
| Signature | (self: Client, event: string, callback: (any) → ()) → () |
| Returns | nothing |
| Async | no |
Subscribe to lifecycle / packet events:
"connect"— fires once when status reachesMENU_READYorIN_WORLD"disconnect"— fires once when status leaves the connected set"p"— every inbound packet"p:<ID>"— only packets with matchingIDfield
client:send("WCM", { msg = "hi" })
client:on("p:WCM", function(params) -- only that ID
print(params)
end)
client:on("p", function(params) -- every inbound packet
print(params)
end)
-- Useful one-shots
client:send("GAW", {}) -- Get Active Worlds
client:send("GRW", {}) -- Get Recent Worlds
client:on("p:GRW", function(params)
-- fires until the script stops
end)
Child instances
Each is reachable via the client or a corresponding getX() global:
client:inventory() -- or getInventory()
client:world() -- or getWorld()
client:console() -- or getConsole()
client:logger() -- or getLogs()
client:scripting() -- or getScripting()
client:world()
| Field | Type |
|---|---|
| Signature | (self: Client) → World |
| Returns | World — current world handle, or nil when no world snapshot is loaded |
| Async | yes |
client:inventory()
| Field | Type |
|---|---|
| Signature | (self: Client) → Inventory |
| Returns | Inventory — snapshot of the bot's inventory at capture time |
| Async | yes |
client:console()
| Field | Type |
|---|---|
| Signature | (self: Client) → Console |
| Returns | Console — per-runtime console buffer (timestamped entries) |
| Async | no |
client:logger()
| Field | Type |
|---|---|
| Signature | (self: Client) → Logger |
| Returns | Logger — flat string-array view of the same buffer |
| Async | no |
client:scripting()
| Field | Type |
|---|---|
| Signature | (self: Client) → Scripting |
| Returns | Scripting — per-bot script engine handle |
| Async | no |