Looping Help?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Candunc
Prole
Posts: 2
Joined: Fri Aug 24, 2012 5:41 am

Looping Help?

Post 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
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Looping Help?

Post 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
Candunc
Prole
Posts: 2
Joined: Fri Aug 24, 2012 5:41 am

Re: Looping Help?

Post 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.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Looping Help?

Post 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
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Looping Help?

Post by kikito »

You might also want to try cron.lua

Disclaimer: cron.lua is my lib.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests