Console
Buffer console per-runtime. Pane "Console" di dashboard baca dari ConsoleHandle yang sama, jadi apapun yang dipush ke sini muncul di UI realtime. FIFO-evict di 2 000 entry by default biar memori long-running script gak balon.
local client = getClient()
local console = client:console() -- atau getConsole()
console:clear()
console:add("pesan kamu sendiri") -- sama dengan print(...)
for i, entry in pairs(console.entries) do
print("{} {} {}", entry.timestamp, entry.type, entry.content)
end
Constructors
getConsole()
| Field | Type |
|---|---|
| Signature | () → Console |
| Returns | Console — handle console shared dari runtime |
| Async | no |
Gak butuh parent client.
client:console()
| Field | Type |
|---|---|
| Signature | (self: Client) → Console |
| Returns | Console — buffer yang sama yang dibaca getConsole() |
| Async | no |
Fields
console.entries
| Field | Type |
|---|---|
| Signature | Console.entries: {ConsoleEntry} |
| Returns | {ConsoleEntry} — snapshot 1-indexed semua entry di buffer |
Snapshot pas akses — re-read buat liat push baru.
for i, entry in pairs(console.entries) do
print(entry.timestamp, entry.type, entry.content)
end
Methods
console:clear()
| Field | Type |
|---|---|
| Signature | (self: Console) → () |
| Returns | nothing |
| Async | no |
Hapus semua entry. Dipake tombol "Clear" di dashboard plus :scripting():execute() di antara run (runtime fresh, console fresh).
console:add(msg)
| Field | Type |
|---|---|
| Signature | (self: Console, msg: string) → () |
| Returns | nothing |
| Async | no |
Push satu entry tagged "info". Sama kayak print(msg) tapi tanpa multi-arg join — pass string yang udah ke-format.
Field ConsoleEntry
| Field | Type | Catatan |
|---|---|---|
timestamp | number | Wall-clock epoch milidetik pas entry di-push. |
type | string | Tag bebas — "info" buat print() dan console:add(), "error" buat error yang ke-raise. |
content | string | Konten yang udah di-render sebagai string tunggal. Multi-arg print(a, b, c) udah di-join di hulu. |
print(...)
| Field | Type |
|---|---|
| Signature | (...: any) → () |
| Returns | nothing |
| Async | no |
Override dari print standar Lua. Push satu entry tagged "info" ke console runtime — buffer yang sama yang dibaca getConsole() dan getLogs(). Gak ada output stdout.
Placeholder {} di string argumen pertama bakal di-interpolasi sama arg sisanya:
print("jalan ke {} {} dalam {}s", x, y, elapsed)
Kalau gak ada placeholder {}, arg di-space-join via tostring() — sama konvensi sama print built-in Lua.