power.plugged
The power.plugged checks if the computer is plugged to AC, returning true or false otherwise.
true
false
Example
--! luart-extensions import power print("Computer is currently powered by "..(power.plugged and "AC" or "battery"))