TimeMillis
Type
Description
-- entity_type_name.lua
local function init(self)
self.Data.previous_time = 0
end
local function update(self, dt)
current_time = api.util.TimeMillis()
if self.Data.previous_time == 0 then
self.Data.previous_time = current_time
end
millisecond_difference = current_time - self.Data.previous_time
print("The time since the last update is "..millisecond_difference..
" milliseconds. "..
"The standard delta time is "..(dt*1000).." milliseconds.")
self.Data.previous_time = current_time
end
-- Get the time every update tick and compare it with the time at the previous tick.
-- This is approximately the same as the update functions delta time (dt) parameter.
-- The time between each update function is dependent on a game's tick rate.
-- Prints (each update, at target tick rate 60):
-- The time since the last update is 16 milliseconds.
-- The standard delta time is 16.719955 milliseconds.Last updated