Skip to content

AGulev/defold-extension-uptime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UpTime

UpTime Native Extension for the Defold Game Engine

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)

Platforms

  • iOS
  • MacOS
  • Android
  • Windows

Installation

To use this library in your Defold project, add the needed version URL to your game.project dependencies from Releases

image

API

uptime.get()

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

If you have any issues, questions or suggestions please create an issue or contact me: me@agulev.com