Big List of Defold Pro Tips!

I like one idea from Monarch for logging handling, so when you have disabled debugging, the log function looks like this:

local function log(...) end

But when you enable debug, by calling monarch.debug(), you change the function to:

function M.debug()
    log = print
end

So you basically only then assign any function to log()

This way, anywhere in the module you write:

log("something to print")

You print it only after enabling debug, otherwise it is just a very quick, almost neglectable call to empty function :heart_eyes:

3 Likes