wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
226 stars 28 forks source link

how to run debug mode, save some codes #1055

Closed fbicirno closed 2 years ago

fbicirno commented 2 years ago

i need a switch that can switch 'debug code' on build.

such as: @debug function printdebug( string txt) print(txt)

if i ban debug in opt 'printdebug' will not build

Frotty commented 2 years ago

just use an if with a global constant variable and it will be optimized away.

constant IS_DEBUG = true
function printDebug(string txt)
    if IS_DEBUG
        ...

You could also use the isProductionBuild variable.