Runs the main operating system event loop, dispatching events to registered handlers.

⚠️ NOTE: Not allowed to be called from within an async function or Promise. This is because TSTL's polyfill of Promises makes use of coroutines, and the internal os.pullEvent() call of this function won't work.

When an error occurs in the event loop

try {
runOsEventLoop(false, true); // Run with debug logging
} catch (error) {
console.error('Event loop crashed:', error);
}
  • Parameters

    • raw: boolean = false

      If true, uses os.pullEventRaw instead of os.pullEvent

    • debug: boolean = false

      If true, prints debug information about events

    Returns never