-
Notifications
You must be signed in to change notification settings - Fork 74
Sdl getPowerInfo
Tangent 128 edited this page Mar 28, 2015
·
3 revisions
Get the current power state.
state, seconds, percentage = function SDL.getPowerInfo()
- state, the current state (see SDL.powerState)
- seconds, the seconds left (if battery)
- percentage, the percentage left (if battery)
local state, secs, pct = SDL.getPowerInfo()
if state == SDL.powerState.OnBattery then
print("Running on battery")
print(string.format("%d seconds left", secs))
end