Connection
client:connect()
| Field | Type |
|---|---|
| Signature | (self: Client) → string? |
| Returns | string? — nil on success, an Errors.* code on failure |
| Common errors | Errors.ALREADY_CONNECTED, Errors.AUTH_FAILED, Errors.TIMEOUT, Errors.BANNED |
| Async | yes |
local err = client:connect()
if err then print("connect failed:", err) end
client:disconnect()
| Field | Type |
|---|---|
| Signature | (self: Client) → string? |
| Returns | string? — nil on clean shutdown, an Errors.* code if the runtime balked |
| Async | yes |
client:connected()
| Field | Type |
|---|---|
| Signature | (self: Client) → boolean |
| Returns | boolean — true when status is MENU_READY or IN_WORLD |
| Async | yes |
client:status()
| Field | Type |
|---|---|
| Signature | (self: Client) → string |
| Returns | string — one of the Status.* constants ("CONNECTING", "MENU_READY", "IN_WORLD", …) |
| Async | yes |
while client:status() ~= Status.IN_WORLD do
sleep(200)
end
client:isAlive()
| Field | Type |
|---|---|
| Signature | (self: Client) → boolean |
| Returns | boolean — true while the bot's TCP runtime is up |
| Async | yes |
client:ping()
| Field | Type |
|---|---|
| Signature | (self: Client) → number? |
| Returns | number? — current RTT in ms, or nil before the first ping cycle |
| Async | yes |
client:lastError()
| Field | Type |
|---|---|
| Signature | (self: Client) → string? |
| Returns | string? — last server-side error string, or nil |
| Async | yes |
client:setSubserver(name)
| Field | Type |
|---|---|
| Signature | (self: Client, name: string) → string? |
| Returns | string? — nil on success |
| Async | yes |
Re-points the lobby for the next connect(). No-op on a live socket — call disconnect() first if you want to switch.
client:setSubserver("game-lava.pixelworlds.pw")
client:refresh()
| Field | Type |
|---|---|
| Signature | (self: Client) → () |
| Returns | nothing — re-snapshots the cached account fields (gems, level, xp, …) in place |
| Async | yes |
Account
client.id
client.userid
client.username
client.email
client.gems
client.bytecoins
client.level
client.xp
client:refresh() -- re-snapshot the fields above
| Field | Type |
|---|---|
id | string — bot id (UUID-ish) |
userid | string? — PlayFab user id, set after login |
username | string? — in-game nick (or email when no nick) |
email | string? — real email when added via email/password auth |
gems | number? — live currency (read-through to state) |
bytecoins | number? |
level | number? — XP level |
xp | number? — XP amount |