Difference between revisions of "love.timer.sleep"
(Add an example) |
|||
Line 9: | Line 9: | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | == Examples == | ||
+ | === Use sleep to cap FPS at 30 === | ||
+ | <source lang="lua"> | ||
+ | function love.update(dt) | ||
+ | if dt < (1/30) then | ||
+ | love.timer.sleep((1/30) - dt) | ||
+ | end | ||
+ | end | ||
+ | </source> | ||
== See Also == | == See Also == | ||
* [[parent::love.timer]] | * [[parent::love.timer]] |
Revision as of 18:37, 31 July 2011
Sleeps the program for the specified amount of time.
Contents
Function
Synopsis
love.timer.sleep( ms )
Arguments
number ms
- Milliseconds to sleep for.
Returns
Nothing.
Examples
Use sleep to cap FPS at 30
function love.update(dt)
if dt < (1/30) then
love.timer.sleep((1/30) - dt)
end
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info