Type Function Return value none Revision Release 2022.3683 Keywords battery, batteryState, init See also batteryState.*
Initializes the plugin and optionally defines a listener function for battery events.
batteryState.init( [listener] )
Listener. The listener function invoked when the battery state/level changes. This function will receive batteryStateEvent events.
If you simply want battery state results as a
local batteryState = require( "plugin.batteryState" ) local json = require( "json" ) local function batteryListener( event ) print( "Battery State event:" ) print( json.prettify(event) ) end -- Initialize plugin with state listener batteryState.init( batteryListener )