Skip to content

Commit

Permalink
Use standard Markdown link syntax for references
Browse files Browse the repository at this point in the history
References are now written using normal links: You now use [`print`] or
[print a string][`print`]) instead of @{print} or @{print|print a
string}.

cct-javdoc still generates @{...} style references, so I have not
enabled the warning for this yet.
  • Loading branch information
SquidDev committed Aug 24, 2023
1 parent 2055052 commit cb84e10
Show file tree
Hide file tree
Showing 84 changed files with 484 additions and 484 deletions.
6 changes: 3 additions & 3 deletions doc/events/alarm.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{alarm} 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.
1. [`string`]: The event name.
2. [`number`]: The ID of the alarm that finished.

## Example
Starts a timer and then waits for it to complete.
Expand Down
10 changes: 5 additions & 5 deletions doc/events/char.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: LicenseRef-CCPL
-->

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
corresponding character. The @{key} should be used if you want to listen to key presses themselves.
corresponding character. The [`key`] should be used if you want to listen to key presses themselves.

## Return values
1. @{string}: The event name.
2. @{string}: The string representing the character that was pressed.
1. [`string`]: The event name.
2. [`string`]: The string representing the character that was pressed.


## Example
Expand Down
6 changes: 3 additions & 3 deletions doc/events/computer_command.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{computer_command} event is fired when the `/computercraft queue` command is run for the current computer.
The [`computer_command`] event is fired when the `/computercraft queue` command is run for the current computer.

## Return Values
1. @{string}: The event name.
2. @{string}<abbr title="Variable number of arguments">&hellip;</abbr>: The arguments passed to the command.
1. [`string`]: The event name.
2. [`string`]<abbr title="Variable number of arguments">&hellip;</abbr>: The arguments passed to the command.

## Example
Prints the contents of messages sent:
Expand Down
6 changes: 3 additions & 3 deletions doc/events/disk.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{disk} event is fired when a disk is inserted into an adjacent or networked disk drive.
The [`disk`] event is fired when a disk is inserted into an adjacent or networked disk drive.

## Return Values
1. @{string}: The event name.
2. @{string}: The side of the disk drive that had a disk inserted.
1. [`string`]: The event name.
2. [`string`]: The side of the disk drive that had a disk inserted.

## Example
Prints a message when a disk is inserted:
Expand Down
6 changes: 3 additions & 3 deletions doc/events/disk_eject.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{disk_eject} event is fired when a disk is removed from an adjacent or networked disk drive.
The [`disk_eject`] event is fired when a disk is removed from an adjacent or networked disk drive.

## Return Values
1. @{string}: The event name.
2. @{string}: The side of the disk drive that had a disk removed.
1. [`string`]: The event name.
2. [`string`]: The side of the disk drive that had a disk removed.

## Example
Prints a message when a disk is removed:
Expand Down
12 changes: 6 additions & 6 deletions doc/events/file_transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ SPDX-FileCopyrightText: 2022 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.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 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.
This event contains a single argument of type [`TransferredFiles`], which can be used to [get the files to be
transferred][`TransferredFiles.getFiles`]. Each file returned is a [binary file handle][`fs.BinaryReadHandle`] with an
additional [getName][`TransferredFile.getName`] method.

## Return values
1. @{string}: The event name
2. @{TransferredFiles}: The list of transferred files.
1. [`string`]: The event name
2. [`TransferredFiles`]: The list of transferred files.

## Example
Waits for a user to drop files on top of the computer, then prints the list of files and the size of each file.
Expand Down
12 changes: 6 additions & 6 deletions doc/events/http_check.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{http_check} event is fired when a URL check finishes.
The [`http_check`] event is fired when a URL check finishes.

This event is normally handled inside @{http.checkURL}, but it can still be seen when using @{http.checkURLAsync}.
This event is normally handled inside [`http.checkURL`], but it can still be seen when using [`http.checkURLAsync`].

## Return Values
1. @{string}: The event name.
2. @{string}: The URL requested to be checked.
3. @{boolean}: Whether the check succeeded.
4. <span class="type">@{string}|@{nil}</span>: If the check failed, a reason explaining why the check failed.
1. [`string`]: The event name.
2. [`string`]: The URL requested to be checked.
3. [`boolean`]: Whether the check succeeded.
4. <span class="type">[`string`]|[`nil`]</span>: If the check failed, a reason explaining why the check failed.
12 changes: 6 additions & 6 deletions doc/events/http_failure.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{http_failure} event is fired when an HTTP request fails.
The [`http_failure`] event is fired when an HTTP request fails.

This event is normally handled inside @{http.get} and @{http.post}, but it can still be seen when using @{http.request}.
This event is normally handled inside [`http.get`] and [`http.post`], but it can still be seen when using [`http.request`].

## Return Values
1. @{string}: The event name.
2. @{string}: The URL of the site requested.
3. @{string}: An error describing the failure.
4. <span class="type">@{http.Response}|@{nil}</span>: A response handle if the connection succeeded, but the server's
1. [`string`]: The event name.
2. [`string`]: The URL of the site requested.
3. [`string`]: An error describing the failure.
4. <span class="type">[`http.Response`]|[`nil`]</span>: A response handle if the connection succeeded, but the server's
response indicated failure.

## Example
Expand Down
10 changes: 5 additions & 5 deletions doc/events/http_success.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{http_success} event is fired when an HTTP request returns successfully.
The [`http_success`] event is fired when an HTTP request returns successfully.

This event is normally handled inside @{http.get} and @{http.post}, but it can still be seen when using @{http.request}.
This event is normally handled inside [`http.get`] and [`http.post`], but it can still be seen when using [`http.request`].

## Return Values
1. @{string}: The event name.
2. @{string}: The URL of the site requested.
3. @{http.Response}: The successful HTTP response.
1. [`string`]: The event name.
2. [`string`]: The URL of the site requested.
3. [`http.Response`]: The successful HTTP response.

## Example
Prints the content of a website (this may fail if the request fails):
Expand Down
12 changes: 6 additions & 6 deletions doc/events/key.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ SPDX-License-Identifier: LicenseRef-CCPL
This event is fired when any key is pressed while the terminal is focused.

This event returns a numerical "key code" (for instance, <kbd>F1</kbd> is 290). This value may vary between versions and
so it is recommended to use the constants in the @{keys} API rather than hard coding numeric values.
so it is recommended to use the constants in the [`keys`] API rather than hard coding numeric values.

If the button pressed represented a printable character, then the @{key} event will be followed immediately by a @{char}
event. If you are consuming text input, use a @{char} event instead!
If the button pressed represented a printable character, then the [`key`] event will be followed immediately by a [`char`]
event. If you are consuming text input, use a [`char`] event instead!

## Return values
1. @{string}: The event name.
2. @{number}: The numerical key value of the key pressed.
3. @{boolean}: Whether the key event was generated while holding the key (@{true}), rather than pressing it the first time (@{false}).
1. [`string`]: The event name.
2. [`number`]: The numerical key value of the key pressed.
3. [`boolean`]: Whether the key event was generated while holding the key ([`true`]), rather than pressing it the first time ([`false`]).

## Example
Prints each key when the user presses it, and if the key is being held.
Expand Down
8 changes: 4 additions & 4 deletions doc/events/key_up.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ SPDX-License-Identifier: LicenseRef-CCPL
Fired whenever a key is released (or the terminal is closed while a key was being pressed).

This event returns a numerical "key code" (for instance, <kbd>F1</kbd> is 290). This value may vary between versions and
so it is recommended to use the constants in the @{keys} API rather than hard coding numeric values.
so it is recommended to use the constants in the [`keys`] API rather than hard coding numeric values.

## Return values
1. @{string}: The event name.
2. @{number}: The numerical key value of the key pressed.
1. [`string`]: The event name.
2. [`number`]: The numerical key value of the key pressed.

## Example
Prints each key released on the keyboard whenever a @{key_up} event is fired.
Prints each key released on the keyboard whenever a [`key_up`] event is fired.

```lua
while true do
Expand Down
16 changes: 8 additions & 8 deletions doc/events/modem_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{modem_message} event is fired when a message is received on an open channel on any @{modem}.
The [`modem_message`] event is fired when a message is received on an open channel on any [`modem`].

## Return Values
1. @{string}: The event name.
2. @{string}: The side of the modem that received the message.
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. <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.
1. [`string`]: The event name.
2. [`string`]: The side of the modem that received the message.
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. <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.
Wraps a [`modem`] peripheral, opens channel 0 for listening, and prints all received messages.

```lua
local modem = peripheral.find("modem") or error("No modem attached", 0)
Expand Down
6 changes: 3 additions & 3 deletions doc/events/monitor_resize.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{monitor_resize} event is fired when an adjacent or networked monitor's size is changed.
The [`monitor_resize`] event is fired when an adjacent or networked monitor's size is changed.

## Return Values
1. @{string}: The event name.
2. @{string}: The side or network ID of the monitor that was resized.
1. [`string`]: The event name.
2. [`string`]: The side or network ID of the monitor that was resized.

## Example
Prints a message when a monitor is resized:
Expand Down
10 changes: 5 additions & 5 deletions doc/events/monitor_touch.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{monitor_touch} event is fired when an adjacent or networked Advanced Monitor is right-clicked.
The [`monitor_touch`] event is fired when an adjacent or networked Advanced Monitor is right-clicked.

## Return Values
1. @{string}: The event name.
2. @{string}: The side or network ID of the monitor that was touched.
3. @{number}: The X coordinate of the touch, in characters.
4. @{number}: The Y coordinate of the touch, in characters.
1. [`string`]: The event name.
2. [`string`]: The side or network ID of the monitor that was touched.
3. [`number`]: The X coordinate of the touch, in characters.
4. [`number`]: The Y coordinate of the touch, in characters.

## Example
Prints a message when a monitor is touched:
Expand Down
10 changes: 5 additions & 5 deletions doc/events/mouse_click.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ This event is fired when the terminal is clicked with a mouse. This event is onl
advanced turtles and pocket computers).

## Return values
1. @{string}: The event name.
2. @{number}: The mouse button that was clicked.
3. @{number}: The X-coordinate of the click.
4. @{number}: The Y-coordinate of the click.
1. [`string`]: The event name.
2. [`number`]: The mouse button that was clicked.
3. [`number`]: The X-coordinate of the click.
4. [`number`]: The Y-coordinate of the click.

## Mouse buttons
Several mouse events (@{mouse_click}, @{mouse_up}, @{mouse_scroll}) contain a "mouse button" code. This takes a
Several mouse events ([`mouse_click`], [`mouse_up`], [`mouse_scroll`]) contain a "mouse button" code. This takes a
numerical value depending on which button on your mouse was last pressed when this event occurred.

| Button Code | Mouse Button |
Expand Down
8 changes: 4 additions & 4 deletions doc/events/mouse_drag.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ SPDX-License-Identifier: LicenseRef-CCPL
This event is fired every time the mouse is moved while a mouse button is being held.

## Return values
1. @{string}: The event name.
2. @{number}: The [mouse button](mouse_click.html#Mouse_buttons) that is being pressed.
3. @{number}: The X-coordinate of the mouse.
4. @{number}: The Y-coordinate of the mouse.
1. [`string`]: The event name.
2. [`number`]: The [mouse button](mouse_click.html#Mouse_buttons) that is being pressed.
3. [`number`]: The X-coordinate of the mouse.
4. [`number`]: The Y-coordinate of the mouse.

## Example
Print the button and the coordinates whenever the mouse is dragged.
Expand Down
8 changes: 4 additions & 4 deletions doc/events/mouse_scroll.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ SPDX-License-Identifier: LicenseRef-CCPL
This event is fired when a mouse wheel is scrolled in the terminal.

## Return values
1. @{string}: The event name.
2. @{number}: The direction of the scroll. (-1 = up, 1 = down)
3. @{number}: The X-coordinate of the mouse when scrolling.
4. @{number}: The Y-coordinate of the mouse when scrolling.
1. [`string`]: The event name.
2. [`number`]: The direction of the scroll. (-1 = up, 1 = down)
3. [`number`]: The X-coordinate of the mouse when scrolling.
4. [`number`]: The Y-coordinate of the mouse when scrolling.

## Example
Prints the direction of each scroll, and the position of the mouse at the time.
Expand Down
8 changes: 4 additions & 4 deletions doc/events/mouse_up.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ SPDX-License-Identifier: LicenseRef-CCPL
This event is fired when a mouse button is released or a held mouse leaves the computer's terminal.

## Return values
1. @{string}: The event name.
2. @{number}: The [mouse button](mouse_click.html#Mouse_buttons) that was released.
3. @{number}: The X-coordinate of the mouse.
4. @{number}: The Y-coordinate of the mouse.
1. [`string`]: The event name.
2. [`number`]: The [mouse button](mouse_click.html#Mouse_buttons) that was released.
3. [`number`]: The X-coordinate of the mouse.
4. [`number`]: The Y-coordinate of the mouse.

## Example
Prints the coordinates and button number whenever the mouse is released.
Expand Down
6 changes: 3 additions & 3 deletions doc/events/paste.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{paste} event is fired when text is pasted into the computer through Ctrl-V (or ⌘V on Mac).
The [`paste`] event is fired when text is pasted into the computer through Ctrl-V (or ⌘V on Mac).

## Return values
1. @{string}: The event name.
2. @{string} The text that was pasted.
1. [`string`]: The event name.
2. [`string`] The text that was pasted.

## Example
Prints pasted text:
Expand Down
6 changes: 3 additions & 3 deletions doc/events/peripheral.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{peripheral} event is fired when a peripheral is attached on a side or to a modem.
The [`peripheral`] event is fired when a peripheral is attached on a side or to a modem.

## Return Values
1. @{string}: The event name.
2. @{string}: The side the peripheral was attached to.
1. [`string`]: The event name.
2. [`string`]: The side the peripheral was attached to.

## Example
Prints a message when a peripheral is attached:
Expand Down
6 changes: 3 additions & 3 deletions doc/events/peripheral_detach.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{peripheral_detach} event is fired when a peripheral is detached from a side or from a modem.
The [`peripheral_detach`] event is fired when a peripheral is detached from a side or from a modem.

## Return Values
1. @{string}: The event name.
2. @{string}: The side the peripheral was detached from.
1. [`string`]: The event name.
2. [`string`]: The side the peripheral was detached from.

## Example
Prints a message when a peripheral is detached:
Expand Down
14 changes: 7 additions & 7 deletions doc/events/rednet_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

The @{rednet_message} event is fired when a message is sent over Rednet.
The [`rednet_message`] event is fired when a message is sent over Rednet.

This event is usually handled by @{rednet.receive}, but it can also be pulled manually.
This event is usually handled by [`rednet.receive`], but it can also be pulled manually.

@{rednet_message} events are sent by @{rednet.run} in the top-level coroutine in response to @{modem_message} events. A @{rednet_message} event is always preceded by a @{modem_message} event. They are generated inside CraftOS rather than being sent by the ComputerCraft machine.
[`rednet_message`] events are sent by [`rednet.run`] in the top-level coroutine in response to [`modem_message`] events. A [`rednet_message`] event is always preceded by a [`modem_message`] event. They are generated inside CraftOS rather than being sent by the ComputerCraft machine.

## Return Values
1. @{string}: The event name.
2. @{number}: The ID of the sending computer.
3. @{any}: The message sent.
4. <span class="type">@{string}|@{nil}</span>: The protocol of the message, if provided.
1. [`string`]: The event name.
2. [`number`]: The ID of the sending computer.
3. [`any`]: The message sent.
4. <span class="type">[`string`]|[`nil`]</span>: The protocol of the message, if provided.

## Example
Prints a message when one is sent:
Expand Down
Loading

0 comments on commit cb84e10

Please sign in to comment.