Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
api:computer [2016/06/17 04:44]
payonel [Computer API]
api:computer [2018/09/10 00:27]
payonel
Line 19: Line 19:
 - `computer.shutdown([reboot:​ boolean])`  ​ - `computer.shutdown([reboot:​ boolean])`  ​
   Shuts down the computer. Optionally reboots the computer, if `reboot` is true, i.e. shuts down, then starts it again automatically. This function never returns.   Shuts down the computer. Optionally reboots the computer, if `reboot` is 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)
 +
 +```lua
 +local computer = require("​computer"​)
 +if computer.uptime() >= 300 then
 +    computer.shutdown(true)
 +end
 +```
 +
 - `computer.getBootAddress():​string`  ​ - `computer.getBootAddress():​string`  ​
   Get the address of the filesystem component from which to try to boot first. *New since OC 1.3*.   Get the address of the filesystem component from which to try to boot first. *New since OC 1.3*.
Line 41: Line 50:
 - `computer.pullSignal([timeout:​ number]): name, ...`  ​ - `computer.pullSignal([timeout:​ number]): name, ...`  ​
   Tries to pull a signal from the queue, waiting up to the specified amount of time before failing and returning `nil`. If no timeout is specified waits forever.  ​   Tries to pull a signal from the queue, waiting up to the specified amount of time before failing and returning `nil`. If no timeout is specified waits forever.  ​
-  The first returned result is the signal name, following results correspond to what was pushed in `pushSignal`,​ for example. These vary based on the even type. +  The first returned result is the signal name, following results correspond to what was pushed in `pushSignal`,​ for example. These vary based on the event type. 
-  ​ +  ​Generally it is more convenient to use `event.pull` from the [[api:event|event]] library. The return value is the very samebut the `event` library provides some more options. 
-  * **important** ​ Do not call this method unless +`computer.beep([frequency:string or number[, durationnumber])` 
-  *   - You do not have the [event|event] library ​availableor +  ​Causes the computer to produce a beep sound at `frequency` Hz for `duration` secondsThis method is overloaded taking a single string parameter as a pattern of dots `.and dashes `.` for short and long beeps respectively.
-  ​* ​  Your intent is to disable driver code from functioning normally ​(such as [[api:component|component]], ​[[api:​filesystem|filesystem]][[api:keyboard|keyboard]],​ and [[api:​term|term]]) +
-  ​* Please use `event.pull`. It returns the same data, provides a more advanced API, and does not interfere with proper driver operaiton+
  
-This example will reboot the computer if it has been running for at least 300 seconds(5 minutes) 
- 
-```lua 
-local computer = require("​computer"​) 
-if computer.uptime() >= 300 then 
-    computer.shutdown(true) 
-end 
-``` 
-` 
 Contents Contents
 ----------- -----------
 {{page>​api:​contents&​noheader&​noeditbutton&​nouser&​nofooter}} {{page>​api:​contents&​noheader&​noeditbutton&​nouser&​nofooter}}