This Defold Native Extension allows receiving a system uptime.
This timer resets when user restarts their device!
Possible use cases:
- If you want to use a timer for restore lives (or something else) in your game without server but want to have better protection against cheaters who just change system time.
- Seed for math.randomseed() (thanks @dragosha for that use case idea)
You can use the UpTime extension in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:
Or point to the ZIP file of a specific release.
Returns system uptime in seconds.
local function update_uptime(self) if uptime then local uptime = uptime.get() print(uptime) -- 809031 end end
Issues and suggestions
Added windows support