Executing code in Test versus Live

The iguana.isTest() function checks if the script is running in the Translator editor (test mode). It returns true when the script is running in the Translator (test mode) and false when the script is running in a live component.

It’s often used with if statements to conditionally execute specific actions.

if iguana.isTest() then -- execute actions that I do not want to run live end if not iguana.isTest() then -- execute actions that I do not want to run in the editor (test mode) end

This function can be very handy when you want to avoid running code while editing. For instance, you may only want to perform a file write operation when the component is running live.

You can also use component.live() in a similar manner to change how code operates in the Translator editor versus when a component is live and running. This is a slightly more intuitive API.

Â