Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AGulev/defold-extension-uptime
This Defold Native Extension allows receiving a system uptime.
https://github.com/AGulev/defold-extension-uptime
defold defold-game-engine defold-library
Last synced: 5 days ago
JSON representation
This Defold Native Extension allows receiving a system uptime.
- Host: GitHub
- URL: https://github.com/AGulev/defold-extension-uptime
- Owner: AGulev
- License: mit
- Created: 2019-03-31T13:44:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-14T16:52:48.000Z (almost 2 years ago)
- Last Synced: 2025-02-06T17:57:20.779Z (6 days ago)
- Topics: defold, defold-game-engine, defold-library
- Language: C++
- Size: 16.6 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-defold - UpTime
README
# UpTime
UpTime [Native Extension](https://www.defold.com/manuals/extensions/) for the [Defold Game Engine](https://www.defold.com)
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](https://github.com/AGulev/defold-extension-uptime/releases)
## API
#### `uptime.get()`
Returns system uptime in seconds.
```lua
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](https://github.com/AGulev/uptime/issues) or contact me: [email protected]