forked from zeng-github01/OC-Doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomputer.lua
More file actions
88 lines (68 loc) · 2.8 KB
/
computer.lua
File metadata and controls
88 lines (68 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---@meta
--- OpenComputers Computer API
---
--- Provides information and control over the running computer, including memory, energy, users, and signals.
---@class ComputerLib
local computer = {}
--- Returns the component address of this computer.
---@return string Component address
function computer.address() end
--- Returns the component address of the temporary file system (if any).
---@return string Temporary filesystem address
function computer.tmpAddress() end
--- Returns the amount of free memory in bytes.
---@return number Free memory (bytes)
function computer.freeMemory() end
--- Returns the total installed memory in bytes.
---@return number Total memory (bytes)
function computer.totalMemory() end
--- Returns the current available energy.
---@return number Energy (EU)
function computer.energy() end
--- Returns the maximum storable energy.
---@return number Max energy (EU)
function computer.maxEnergy() end
--- Returns the computer's uptime in seconds.
---@return number Uptime (seconds)
function computer.uptime() end
--- Shuts down or reboots the computer.
---@param reboot boolean? If true, reboots instead of shutting down
function computer.shutdown(reboot) end
--- Gets the boot address of the filesystem to boot from.
---@return string Filesystem address
function computer.getBootAddress() end
--- Sets the boot address of the filesystem to boot from.
---@param address string? Filesystem address (nil to clear)
function computer.setBootAddress(address) end
--- Returns the current runlevel ("S", "1", etc).
---@return string|number Runlevel
function computer.runlevel() end
--- Returns a list of all registered users.
---@return string,... Usernames
function computer.users() end
--- Registers a new user.
---@param name string Username
---@return boolean|nil "Success or nil and error message"
---@return string? Error message
function computer.addUser(name) end
--- Removes a registered user.
---@param name string Username
---@return boolean Success
function computer.removeUser(name) end
--- Pushes a new signal into the event queue.
---@param name string Signal name
---@param ... any Signal arguments
function computer.pushSignal(name, ...) end
--- Pulls a signal from the event queue, waiting up to timeout seconds.
---@param timeout number? Maximum time to wait (optional)
---@return string|nil Signal name, or nil if timed out
---@return ... Signal arguments
function computer.pullSignal(timeout) end
--- Produces a beep sound at the given frequency and duration, or plays a pattern.
---@param frequency string|number? Frequency in Hz or pattern string (optional)
---@param duration number? Duration in seconds (optional)
function computer.beep(frequency, duration) end
--- Returns a table of information about installed devices.
---@return table Device info
function computer.getDeviceInfo() end
return computer