Page 1 of 1

Looping Help?

Posted: Fri Aug 24, 2012 5:49 am
by Candunc
Hello, I am new to LÖVE and I have a question.

How can I have a exit command that will work (either press exit in game or click the x)
I have a looping command that waits 30 seconds between every command sent too.

This is what I want (Just an example, I have the code already)

[loop1]
while wloop == 1 do
os.execute("code goes here")
love.timer.sleep(30)
end

function love.quit()
-- quit command goes here
end

Re: Looping Help?

Posted: Fri Aug 24, 2012 8:10 am
by Roland_Yonaba
Candunc wrote:Hello, I am new to LÖVE and I have a question.
How can I have a exit command that will work ...
Meaning this ?

Code: Select all

love.event.push ('quit')
This is legible with love 0.8.0, though.
See love.event.push on the wiki, BTW.

EDIT: See also love.event.quit

Re: Looping Help?

Posted: Fri Aug 24, 2012 2:47 pm
by Candunc
Roland_Yonaba wrote:

Code: Select all

love.event.push ('quit')
This is legible with love 0.8.0, though.
See love.event.push on the wiki, BTW.

EDIT: See also love.event.quit
No, I have the code, I just need help with having it execute. The 30 second wait time freezes LÖVE so that no command will work, making it unable to quit.

Re: Looping Help?

Posted: Fri Aug 24, 2012 3:09 pm
by Roland_Yonaba
I am not sure on what you need for. Maybe its delaying.
If so, you you queue your commands in a table, map each one with a delay time, a execute them according to timer.
Possible ways of doing this are listed here: viewtopic.php?f=4&t=10585

Re: Looping Help?

Posted: Sat Aug 25, 2012 2:02 pm
by kikito
You might also want to try cron.lua

Disclaimer: cron.lua is my lib.