I have used the timers extension to run some code after a certain time period using the code shown below.
timer.after(3000, function () {})
Is there a way to cancel this event / stop it from running after it has been called?
Note: I have tried wrapping the function in an if statement (e.g. execute this code only if this condition is met and game is in this state), however, when my game returns to the state where the event is meant to be triggered, there is a chance that this event will still run, so this method doesn’t seem to work in my case.