Time: Difference between revisions
Jump to navigation
Jump to search
imported>Felice Enellen (we should actually force t() to have its own page that redirects here, so let's get that started) |
|||
| Line 7: | Line 7: | ||
'''Note:''' This uses the built-in number type to represent the number of seconds, which has an upper limit of 32,767. (roughly 9h 6m) | '''Note:''' This uses the built-in number type to represent the number of seconds, which has an upper limit of 32,767. (roughly 9h 6m) | ||
<code>t()</code> is a short alias for <code>time()</code>. | Note that <code>[[T|t()]]</code> is a short alias for <code>time()</code>. | ||
== Examples == | == Examples == | ||
Revision as of 13:19, 13 March 2021
time( )
- Returns the amount of time since PICO-8 was last started, as a fractional number of seconds.
The time() function returns the fractional number of seconds since PICO-8 was started.
Note: This uses the built-in number type to represent the number of seconds, which has an upper limit of 32,767. (roughly 9h 6m)
Note that t() is a short alias for time().
Examples
function _init()
last = time()
end
function _update()
-- (empty update to use game loop)
end
function _draw()
cls()
if (time() - last) > 10 then
print("time's up!", 44, 60, 7)
end
end