mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-13 19:50:31 +00:00
Some event typo fixes
This commit is contained in:
parent
f43b839056
commit
2014e9527e
@ -3,19 +3,20 @@ module: [kind=event] alarm
|
||||
see: os.setAlarm To start an alarm.
|
||||
---
|
||||
|
||||
The @{timer} event is fired when an alarm started with @{os.setAlarm} completes.
|
||||
The @{alarm} event is fired when an alarm started with @{os.setAlarm} completes.
|
||||
|
||||
## Return Values
|
||||
1. @{string}: The event name.
|
||||
2. @{number}: The ID of the alarm that finished.
|
||||
|
||||
## Example
|
||||
Starts a timer and then prints its ID:
|
||||
Starts a timer and then waits for it to complete.
|
||||
|
||||
```lua
|
||||
local alarmID = os.setAlarm(os.time() + 0.05)
|
||||
local alarm_id = os.setAlarm(os.time() + 0.05)
|
||||
local event, id
|
||||
repeat
|
||||
event, id = os.pullEvent("alarm")
|
||||
until id == alarmID
|
||||
until id == alarm_id
|
||||
print("Alarm with ID " .. id .. " was fired")
|
||||
```
|
||||
|
@ -3,7 +3,7 @@ module: [kind=event] char
|
||||
see: key To listen to any key press.
|
||||
---
|
||||
|
||||
The @{char} event is fired when a character is _typed_ on the keyboard.
|
||||
The @{char} event is fired when a character is typed on the keyboard.
|
||||
|
||||
The @{char} event is different to a key press. Sometimes multiple key presses may result in one character being
|
||||
typed (for instance, on some European keyboards). Similarly, some keys (e.g. <kbd>Ctrl</kbd>) do not have any
|
||||
@ -16,9 +16,10 @@ corresponding character. The @{key} should be used if you want to listen to key
|
||||
|
||||
## Example
|
||||
Prints each character the user presses:
|
||||
|
||||
```lua
|
||||
while true do
|
||||
local event, character = os.pullEvent("char")
|
||||
print(character .. " was pressed.")
|
||||
local event, character = os.pullEvent("char")
|
||||
print(character .. " was pressed.")
|
||||
end
|
||||
```
|
||||
|
@ -5,9 +5,9 @@ since: 1.101.0
|
||||
|
||||
The @{file_transfer} event is queued when a user drags-and-drops a file on an open computer.
|
||||
|
||||
This event contains a single argument, that in turn has a single method @{TransferredFiles.getFiles|getFiles}. This
|
||||
returns the list of files that are being transferred. Each file is a @{fs.BinaryReadHandle|binary file handle} with an
|
||||
additional @{TransferredFile.getName|getName} method.
|
||||
This event contains a single argument of type @{TransferredFiles}, which can be used to @{TransferredFiles.getFiles|get
|
||||
the files to be transferred}. Each file returned is a @{fs.BinaryReadHandle|binary file handle} with an additional
|
||||
@{TransferredFile.getName|getName} method.
|
||||
|
||||
## Return values
|
||||
1. @{string}: The event name
|
||||
|
@ -11,4 +11,4 @@ This event is normally handled inside @{http.checkURL}, but it can still be seen
|
||||
1. @{string}: The event name.
|
||||
2. @{string}: The URL requested to be checked.
|
||||
3. @{boolean}: Whether the check succeeded.
|
||||
4. @{string|nil}: If the check failed, a reason explaining why the check failed.
|
||||
4. <span class="type">@{string}|@{nil}</span>: If the check failed, a reason explaining why the check failed.
|
||||
|
@ -11,7 +11,8 @@ This event is normally handled inside @{http.get} and @{http.post}, but it can s
|
||||
1. @{string}: The event name.
|
||||
2. @{string}: The URL of the site requested.
|
||||
3. @{string}: An error describing the failure.
|
||||
4. @{http.Response|nil}: A response handle if the connection succeeded, but the server's response indicated failure.
|
||||
4. <span class="type">@{http.Response}|@{nil}</span>: A response handle if the connection succeeded, but the server's
|
||||
response indicated failure.
|
||||
|
||||
## Example
|
||||
Prints an error why the website cannot be contacted:
|
||||
|
@ -10,7 +10,7 @@ This event is normally handled inside @{http.get} and @{http.post}, but it can s
|
||||
## Return Values
|
||||
1. @{string}: The event name.
|
||||
2. @{string}: The URL of the site requested.
|
||||
3. @{http.Response}: The handle for the response text.
|
||||
3. @{http.Response}: The successful HTTP response.
|
||||
|
||||
## Example
|
||||
Prints the content of a website (this may fail if the request fails):
|
||||
|
@ -10,7 +10,7 @@ The @{modem_message} event is fired when a message is received on an open channe
|
||||
3. @{number}: The channel that the message was sent on.
|
||||
4. @{number}: The reply channel set by the sender.
|
||||
5. @{any}: The message as sent by the sender.
|
||||
6. @{number}: The distance between the sender and the receiver, in blocks.
|
||||
6. <span class="type">@{number}|@{nil}</span>: The distance between the sender and the receiver in blocks, or @{nil} if the message was sent between dimensions.
|
||||
|
||||
## Example
|
||||
Wraps a @{modem} peripheral, opens channel 0 for listening, and prints all received messages.
|
||||
@ -20,7 +20,9 @@ local modem = peripheral.find("modem") or error("No modem attached", 0)
|
||||
modem.open(0)
|
||||
|
||||
while true do
|
||||
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
|
||||
print(("Message received on side %s on channel %d (reply to %d) from %f blocks away with message %s"):format(side, channel, replyChannel, distance, tostring(message)))
|
||||
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
|
||||
print(("Message received on side %s on channel %d (reply to %d) from %f blocks away with message %s"):format(
|
||||
side, channel, replyChannel, distance, tostring(message)
|
||||
))
|
||||
end
|
||||
```
|
||||
|
@ -6,10 +6,11 @@ The @{monitor_resize} event is fired when an adjacent or networked monitor's siz
|
||||
|
||||
## Return Values
|
||||
1. @{string}: The event name.
|
||||
2. @{string}: The side or network ID of the monitor that resized.
|
||||
2. @{string}: The side or network ID of the monitor that was resized.
|
||||
|
||||
## Example
|
||||
Prints a message when a monitor is resized:
|
||||
|
||||
```lua
|
||||
while true do
|
||||
local event, side = os.pullEvent("monitor_resize")
|
||||
|
@ -14,7 +14,7 @@ This event is usually handled by @{rednet.receive}, but it can also be pulled ma
|
||||
1. @{string}: The event name.
|
||||
2. @{number}: The ID of the sending computer.
|
||||
3. @{any}: The message sent.
|
||||
4. @{string|nil}: The protocol of the message, if provided.
|
||||
4. <span class="type">@{string}|@{nil}</span>: The protocol of the message, if provided.
|
||||
|
||||
## Example
|
||||
Prints a message when one is sent:
|
||||
|
@ -10,7 +10,8 @@ When this event fires, some parts of the terminal may have been moved or deleted
|
||||
not using @{term.setCursorPos}) can ignore this event, but more complex GUI programs should redraw the entire screen.
|
||||
|
||||
## Example
|
||||
Prints :
|
||||
Print a message each time the terminal is resized.
|
||||
|
||||
```lua
|
||||
while true do
|
||||
os.pullEvent("term_resize")
|
||||
|
@ -10,12 +10,12 @@ The @{timer} event is fired when a timer started with @{os.startTimer} completes
|
||||
2. @{number}: The ID of the timer that finished.
|
||||
|
||||
## Example
|
||||
Starts a timer and then prints its ID:
|
||||
Start and wait for a timer to finish.
|
||||
```lua
|
||||
local timerID = os.startTimer(2)
|
||||
local timer_id = os.startTimer(2)
|
||||
local event, id
|
||||
repeat
|
||||
event, id = os.pullEvent("timer")
|
||||
until id == timerID
|
||||
until id == timer_id
|
||||
print("Timer with ID " .. id .. " was fired")
|
||||
```
|
||||
|
@ -555,7 +555,7 @@ public class TurtleAPI implements ILuaAPI {
|
||||
* @throws LuaException If the refuel count is out of range.
|
||||
* @cc.treturn [1] true If the turtle was refuelled.
|
||||
* @cc.treturn [2] false If the turtle was not refuelled.
|
||||
* @cc.treturn [2] string The reason the turtle was not refuelled (
|
||||
* @cc.treturn [2] string The reason the turtle was not refuelled.
|
||||
* @cc.usage Refuel a turtle from the currently selected slot.
|
||||
* <pre>{@code
|
||||
* local level = turtle.getFuelLevel()
|
||||
|
Loading…
Reference in New Issue
Block a user