1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 12:10:30 +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 @@ module: [kind=event] alarm
see: os.setAlarm To start an 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 ## Return Values
1. @{string}: The event name. 1. @{string}: The event name.
2. @{number}: The ID of the alarm that finished. 2. @{number}: The ID of the alarm that finished.
## Example ## Example
Starts a timer and then prints its ID: Starts a timer and then waits for it to complete.
```lua ```lua
local alarmID = os.setAlarm(os.time() + 0.05) local alarm_id = os.setAlarm(os.time() + 0.05)
local event, id local event, id
repeat repeat
event, id = os.pullEvent("alarm") event, id = os.pullEvent("alarm")
until id == alarmID until id == alarm_id
print("Alarm with ID " .. id .. " was fired") print("Alarm with ID " .. id .. " was fired")
``` ```

View File

@ -3,7 +3,7 @@ module: [kind=event] char
see: key To listen to any key press. 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 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 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 ## Example
Prints each character the user presses: Prints each character the user presses:
```lua ```lua
while true do while true do
local event, character = os.pullEvent("char") local event, character = os.pullEvent("char")
print(character .. " was pressed.") print(character .. " was pressed.")
end end
``` ```

View File

@ -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. 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 This event contains a single argument of type @{TransferredFiles}, which can be used to @{TransferredFiles.getFiles|get
returns the list of files that are being transferred. Each file is a @{fs.BinaryReadHandle|binary file handle} with an the files to be transferred}. Each file returned is a @{fs.BinaryReadHandle|binary file handle} with an additional
additional @{TransferredFile.getName|getName} method. @{TransferredFile.getName|getName} method.
## Return values ## Return values
1. @{string}: The event name 1. @{string}: The event name

View File

@ -11,4 +11,4 @@ This event is normally handled inside @{http.checkURL}, but it can still be seen
1. @{string}: The event name. 1. @{string}: The event name.
2. @{string}: The URL requested to be checked. 2. @{string}: The URL requested to be checked.
3. @{boolean}: Whether the check succeeded. 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 @@ This event is normally handled inside @{http.get} and @{http.post}, but it can s
1. @{string}: The event name. 1. @{string}: The event name.
2. @{string}: The URL of the site requested. 2. @{string}: The URL of the site requested.
3. @{string}: An error describing the failure. 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 ## Example
Prints an error why the website cannot be contacted: Prints an error why the website cannot be contacted:

View File

@ -10,7 +10,7 @@ This event is normally handled inside @{http.get} and @{http.post}, but it can s
## Return Values ## Return Values
1. @{string}: The event name. 1. @{string}: The event name.
2. @{string}: The URL of the site requested. 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 ## Example
Prints the content of a website (this may fail if the request fails): Prints the content of a website (this may fail if the request fails):

View File

@ -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. 3. @{number}: The channel that the message was sent on.
4. @{number}: The reply channel set by the sender. 4. @{number}: The reply channel set by the sender.
5. @{any}: The message as sent 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 ## Example
Wraps a @{modem} peripheral, opens channel 0 for listening, and prints all received messages. 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) modem.open(0)
while true do while true do
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_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))) 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 end
``` ```

View File

@ -6,10 +6,11 @@ The @{monitor_resize} event is fired when an adjacent or networked monitor's siz
## Return Values ## Return Values
1. @{string}: The event name. 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 ## Example
Prints a message when a monitor is resized: Prints a message when a monitor is resized:
```lua ```lua
while true do while true do
local event, side = os.pullEvent("monitor_resize") local event, side = os.pullEvent("monitor_resize")

View File

@ -14,7 +14,7 @@ This event is usually handled by @{rednet.receive}, but it can also be pulled ma
1. @{string}: The event name. 1. @{string}: The event name.
2. @{number}: The ID of the sending computer. 2. @{number}: The ID of the sending computer.
3. @{any}: The message sent. 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 ## Example
Prints a message when one is sent: Prints a message when one is sent:

View File

@ -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. not using @{term.setCursorPos}) can ignore this event, but more complex GUI programs should redraw the entire screen.
## Example ## Example
Prints : Print a message each time the terminal is resized.
```lua ```lua
while true do while true do
os.pullEvent("term_resize") os.pullEvent("term_resize")

View File

@ -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. 2. @{number}: The ID of the timer that finished.
## Example ## Example
Starts a timer and then prints its ID: Start and wait for a timer to finish.
```lua ```lua
local timerID = os.startTimer(2) local timer_id = os.startTimer(2)
local event, id local event, id
repeat repeat
event, id = os.pullEvent("timer") event, id = os.pullEvent("timer")
until id == timerID until id == timer_id
print("Timer with ID " .. id .. " was fired") print("Timer with ID " .. id .. " was fired")
``` ```

View File

@ -555,7 +555,7 @@ public class TurtleAPI implements ILuaAPI {
* @throws LuaException If the refuel count is out of range. * @throws LuaException If the refuel count is out of range.
* @cc.treturn [1] true If the turtle was refuelled. * @cc.treturn [1] true If the turtle was refuelled.
* @cc.treturn [2] false If the turtle was not 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. * @cc.usage Refuel a turtle from the currently selected slot.
* <pre>{@code * <pre>{@code
* local level = turtle.getFuelLevel() * local level = turtle.getFuelLevel()