Practical guide
Read a bounded query across pages
Traverse a detached owner snapshot without unbounded work or assumptions about container order.
Procedure
- Choose a page size no larger than the data needed for one callback.
- Call world.query with the registered query ID and explicit filters.
- Consume records in returned stable order.
- If a next cursor is present, retain that opaque cursor and continue in a later bounded callback.
- Stop or degrade presentation when the query budget is exhausted or the capability is unavailable.
Example
local cursor = nil
repeat
local result = world.query(
"world.job.info",
{page_size = 16, cursor = cursor}
)
assert(result.status == "completed", result.detail)
for _, record in ipairs(result.records) do
-- Consume detached records.
end
cursor = result.next_cursor
until cursor == nil
Constraints and recovery
- Cursors are opaque continuation values and are valid only for their registered query contract.
- Do not convert a presentation query into an every-frame scan of the whole world.
- Queries read owner-built snapshots and cannot repair or author missing facts.