mgba

This module allows you to output text to the debug console in mGBA.

It is automatically initialised on import, so you don’t have to call open manually.

Warning

This module will crash your game on certain emulators (gpSP), so you should turn it off by passing -d:natuMgbaLogging=off for release builds of your game.

type LogLevel = enum
  • logFatal
  • logError
  • logWarnThis will be used if you don’t specify a log level, as it’s the least-severe one that’s enabled by default in mGBA.
  • logInfo
  • logDebug
template printf(str: cstring, args: varargs[untyped])

Output a formatted message to the mGBA log.

Example:

printf("Spawned item at %d, %d", pos.x, pos.y)
template printf(level: LogLevel, str: cstring, args: varargs[untyped])

Output a formatted message to the mGBA log, at a specified level of visibility.

Example:

printf(logFatal, "Uh oh, something went wrong!")
proc open(): bool
proc close()