1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-22 05:03:22 +00:00

Some event typo fixes

This commit is contained in:
Jonathan Coates 2023-01-16 22:53:58 +00:00
parent f43b839056
commit 2014e9527e
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
12 changed files with 30 additions and 23 deletions

View File

@ -3,19 +3,20 @@
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")
```

View File

@ -3,7 +3,7 @@
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 @@ ## Return values
## 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
```

View File

@ -5,9 +5,9 @@
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

View File

@ -11,4 +11,4 @@ ## Return Values
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.

View File

@ -11,7 +11,8 @@ ## Return Values
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:

View File

@ -10,7 +10,7 @@
## 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):

View File

@ -10,7 +10,7 @@ ## Return Values
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 @@ ## Example
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
```

View File

@ -6,10 +6,11 @@
## 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")

View File

@ -14,7 +14,7 @@ ## Return Values
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:

View File

@ -10,7 +10,8 @@
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")

View File

@ -10,12 +10,12 @@ ## Return Values
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")
```

View File

@ -555,7 +555,7 @@ public final Object getFuelLevel() {
* @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()