Waiting an amount of time

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
Nilyus
Prole
Posts: 1
Joined: Mon Jun 06, 2011 12:13 am

Waiting an amount of time

Post by Nilyus »

Hello, I'm new to Löve but it's been pretty fun to experiment with. :awesome: Anyway, I've been wondering if there's a method that will wait a certain amount of time before continuing on with the code built in to Löve, and where I can get or code something to do that for me if it's not already implemented into the library. Thanks!
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Waiting an amount of time

Post by Lafolie »

What exactly do you intend to use this for?
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Waiting an amount of time

Post by BlackBulletIV »

Why would you want to pause the whole execution of the program? (That's what you're describing.) Anyway, one way to do it is to redefine love.run to not do anything inside of the while loop. If you're wanting to wait a certain amount of time to perform an action, using timers is the best way. You could write your own, but I would recommend using a library, such as cron.lua or the timers in HUMP.

As for where you can get code that does something that's not implemented into LOVE. There are a large amount of libraries around which are written in Lua. If you need something that must be on the C++ side, you'll have to integrate it yourself into the LOVE source code and compile your own version.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Waiting an amount of time

Post by TechnoCat »

If it truly is your intent to pause execution: love.timer.sleep

And a way to implement it without using the built-in sleep function would be to busy-wait and check the time.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Waiting an amount of time

Post by BlackBulletIV »

TechnoCat wrote:If it truly is your intent to pause execution: love.timer.sleep
Totally forgot about that one.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest