mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-09 15:25:56 -04:00
Created Component computer (markdown)
parent
9faa0b8041
commit
286cfcab64
17
Component-computer.md
Normal file
17
Component-computer.md
Normal file
@ -0,0 +1,17 @@
|
||||
Computers provide a couple of API callbacks. Note that these can only be called by the computer itself, or its direct neighbors (i.e. other computers that share a face with that computer). Also note that since robots cannot interact with external components they cannot start/stop/query computers, but computers can interact with robots sitting next to them.
|
||||
|
||||
Component name: `computer`.
|
||||
Callbacks:
|
||||
- `start(): boolean`
|
||||
Tries to start the computer. Returns `true` on success, `false` otherwise. Note that this will also return `false` if the computer was already running. If the computer is currently shutting down, this will cause the computer to reboot instead.
|
||||
- `stop(): boolean`
|
||||
Tries to stop the computer. Returns `true` on success, `false` otherwise. Also returns `false` if the computer is already stopped.
|
||||
- `isRunning(): boolean`
|
||||
Returns whether the computer is currently running.
|
||||
|
||||
Example use:
|
||||
```lua
|
||||
local c = component.computer -- get primary computer, e.g. self
|
||||
print(c.isRunning()) -- definitely true if it's this computer
|
||||
c.stop() -- basically like computer.shutdown() if it's this computer
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user