Check in lua script if debug/release build (DEF-1929) (SOLVED)

Hello all,

I want to make a cheats menu, but I don’t want it to be available in release builds. Is there any way to check this in lua script?

Thanks!

1 Like

There is currently no way of knowing if the engine is a debug or release build. We have discussed adding this to sys.get_engine_info(). It’s in the backlog as DEF-1929.

What you can do is to set a custom flag in game.project and read that value using sys.get_config() but you’d need to either script your build process or make sure to always set the flag to the correct state in game.project before building if you do it manually.

Okay I will use the temporary solution until this is added, thanks!

You can take advantage of reverse hashing which exist only on debug builds:

if "" .. hash("debug") == "[debug]" then
    -- debug mode
else
    -- release mode
end
3 Likes

Cool, that seems a better temporary solution hehehe. Thx!

Solved in Defold 1.2.116 (sys.get_engine_info().is_debug)

8 Likes