#how do i use tick()?

2 messages · Page 1 of 1 (latest)

solid grove
#

it counts up
it depends on what you want to do

modest sonnet
#

In Lua, tick() is a global function that returns the number of seconds since the Unix epoch (January 1, 1970 at 00:00:00 UTC).

Here is an example of how you can use tick():

lua
Copy code
local startTime = tick()
wait(5)
local endTime = tick()

print("The elapsed time is: ", endTime - startTime, " seconds")
In the example above, startTime is set to the value of tick() before waiting for 5 seconds. endTime is then set to the current tick() value after waiting for 5 seconds. The difference between the endTime and startTime is then calculated and printed to the console.