m.global is a special roSGNode provided by the Roku SceneGraph runtime. Unlike local m fields, m.global is shared across all components and tasks simultaneously — reads and writes are thread-safe and changes are immediately visible to any observer registered with observeField.
GTV_InitGlobalState() in source/AppState.brs calls m.global.addFields({...}) once at startup inside MainScene.init() to declare every field with its initial value.
Reading and writing global fields
From a component (render thread):m.global through the same m.global reference available in their script scope:
Tasks should write to their own output fields (e.g.,
done, result) rather than writing directly to m.global. MainScene reads task output and updates m.global on the render thread. This avoids race conditions between the render thread and task threads.Field reference
Server and connectivity
Authentication
Channel list and selection
Player state
Ad state
Device info
Deep links and beacons
launchDeepLink and inputDeepLink are fields on m.top (the MainScene node), not on m.global. They are declared in MainScene.xml with onChange handlers and appear here for completeness.Complete initialisation listing
The fulladdFields call from source/AppState.brs:
Registry fields
Some state is persisted across sessions in the Roku Registry (roRegistrySection named "GlobalTV"). These values survive channel updates and device reboots.