Skip to main content
Run JavaScript in the game’s Panorama UI.
RunScript runs on the game thread; other threads queue it. JS errors appear in Panorama’s console. Invalid or unavailable panels raise Lua errors.
Returns nil if no panel matches. For duplicate IDs, pass a root to select the tree.

Bridge

Pass a JS function body; use return for results. The local JS bridge provides the helpers below. Execution and callbacks run asynchronously on the game thread.
  • Values: strings, booleans, finite numbers, plain objects and dense arrays. Arrays become one-based Lua tables; empty objects and arrays both become empty tables.
  • JS null becomes json.null; top-level undefined becomes nil. Keep XUIDs as strings.
  • Unsupported values, including functions, Promises, cycles and nested undefined, return serialization errors. Promises are not awaited.
  • Failures call callback(nil, err) with err.code, err.message and, when available, err.stack. Invalid submissions raise Lua errors.
  • Requests time out after five seconds. Source limit: 32 KiB; encoded message limit: 64 KiB. Use \u0000 instead of literal NUL bytes in source.
  • Event names are local to each bridge: 1–128 printable ASCII characters.
  • Close or script unload cancels bridge listeners, schedules and pending callbacks. Direct Panorama registrations require your own cleanup.
  • Create bridges with explicit panels on the game thread. Recreate the bridge if its panel or context is destroyed.