Page 1 of 1

How do I skip out of the love.update function?

Posted: Thu May 23, 2013 2:05 pm
by aeTIos
Hello guys,

first post here! A friend of mine an I are working together on a game, and for debugging purposes, I want to be able to skip out of the love.update function. So my question is: Is this possible, and if yes, how would I do it?

TIA!

Re: How do I skip out of the love.update function?

Posted: Thu May 23, 2013 2:18 pm
by Robin
Welcome!

What do you mean by "skip out of love.update"? Do you mean returning in the middle of the function?

Maybe you could describe the kind of effect you want to have.

Re: How do I skip out of the love.update function?

Posted: Thu May 23, 2013 3:32 pm
by micha
As Robin says, you can call "return" to skip out of the function at any place.

If you simply want to skip the function, then I suggest using a gamestate for that, i.e. a variable containing a string that tells you, what state you are in.
Then write in the beginning of the love.update:

Code: Select all

function love.update(dt)
if state = 'skip' then
  return
end
...
end

Re: How do I skip out of the love.update function?

Posted: Thu May 23, 2013 3:53 pm
by Robin
micha wrote:Then write in the beginning of the love.update:
Do replace = by ==.

Re: How do I skip out of the love.update function?

Posted: Thu May 23, 2013 7:33 pm
by micha
Robin wrote:Do replace = by ==.
Thanks.