Skip to content

11 Global Variables

PlayeRom edited this page Dec 4, 2025 · 4 revisions

The framework provides the following global variables that you can use in your add-on:

g_Addon

Object of addons.Addon ghost, here is everything about your add-on.

g_FGVersion

Object of nasal/Utils/FGVersion class. With this object you can easily add conditions related to the FlightGear version, e.g.:

if (g_FGVersion.lowerThan('2024.1.1')) {
    # ...
}

g_isDevMode

Boolean variable. Defaults to false. Set to true when you set the DEV_MODE=true variable in the .env file. This variable allows you to set conditions to place code only for development, such as logging in large and heavy loops that shouldn't be executed for the end user, but you want to leave it in the code for development purposes.

g_VersionChecker

Object of one of method to check the new version of your add-on: /framework/nasal/VersionCheck/GitTagVersionChecker.nas or /framework/nasal/VersionCheck/MetaDataVersionChecker.nas. See Version Checker.

ADDON_LOG_LEVEL

The constant using in Log.print() method (which is a wrapper for logprint, where first parameter is log level, where the ADDON_LOG_LEVEL can be use here). This constant is ease configurable by .env file, so you don't have to modify it in the code.

By default, it's set to LOG_INFO, so to see the logs from Log.print(), you'd have to run the simulator with the --log-level=info option. But you don't have to. You can also set ADDON_LOG_LEVEL=LOG_ALERT in the .env file, which will cause Log.print() to always be logged, without the need to use FlightGear's --log-level option.

Clone this wiki locally