Scripting: Preprocessor Macros – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search

Preprocessor macros provide helpful context information, especially useful in debug.

Macro Description Example

__FILE__

Is replaced by a string containing the current file's relative path.
Print(__FILE__, LogLevel.NORMAL); // ends as e.g Print("scripts/WorkbenchGame/ScriptEditor/TAG_MyTestPlugin.c", LogLevel.NORMAL); // this is absolutely valid string absPath; Workbench.GetAbsolutePath(__FILE__, absPath, true); Print(absPath); // e.g "D:/MyMods/TAG_MyMod/scripts/WorkbenchGame/ScriptEditor/TAG_MyTestPlugin.c"

__LINE__

Is replaced by a string containing the current file's line number.
Print(__LINE__ + 2, LogLevel.NORMAL); // ends as Print("4" + 2, LogLevel.NORMAL); // "42"