This API mainly provides information about the computer a Lua state is running on, such as its address and uptime. It also contains functions for user management. This could belong to the
os table, but in order to keep that “clean” it's in its own API.
rebootis true, i.e. shuts down, then starts it again automatically. This function never returns. This example will reboot the computer if it has been running for at least 300 seconds(5 minutes)
local computer = require("computer") if computer.uptime() >= 300 then computer.shutdown(true) end
Returns the current runlevel the computer is in. Current Runlevels in OpenOS are:
S: Single-User mode, no components or filesystems initialized yet
1: Single-User mode, filesystems and components initialized - OpenOS finished booting
computer.users(): string, ...
table.packon it, first. Please see the user rights documentation.
computer.addUser(name: string): boolean or nil, string
trueif the user was successfully added. Returns
niland an error message otherwise.
useradd USERis a command line option to invoke this method.
computer.removeUser(name: string): boolean
trueif the user was removed,
falseif they weren't registered in the first place.
userdel USERis a command line option to invoke this method.
computer.pushSignal(name: string[, ...])
computer.pullSignal([timeout: number]): name, ...
nil. If no timeout is specified waits forever.
pushSignal, for example. These vary based on the even type.
event.pullinstead. It returns the same data, provides a more advanced API, and does not interfere with proper driver operation. Do not call this method unless