I’m trying to wait until a condition is met, in this case until all enemies have been defeated in a wave. This is my code:
while self.enemies_alive > 0 do
-- rest of code goes here
end
I’ve used while loops before, more so in Luau (an altered version of Lua). That version requires you to use “wait()” to ensure the script doesn’t time out.
However, when i run this code, my game crashes. I can’t find anything else on the forum or on the internet regarding while loops in defold, so is it a real thing?
If it is, how do i ensure it doesn’t crash my game?
Many thanks!