DOCS: Improve/correct some API docs related to ports (#772)

This commit is contained in:
muesli4brekkies 2023-09-02 15:57:31 +01:00 committed by GitHub
parent 52769706d2
commit 66ac31ee99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 13 deletions

@ -9,14 +9,14 @@ Clear data from a port.
**Signature:** **Signature:**
```typescript ```typescript
clearPort(handle: number): void; clearPort(portNumber: number): void;
``` ```
## Parameters ## Parameters
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| handle | number | Port to clear. | | portNumber | number | Port to clear data from. Must be a positive integer. |
**Returns:** **Returns:**

@ -16,7 +16,7 @@ getPortHandle(portNumber: number): NetscriptPort;
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| portNumber | number | Port number. Must be an integer between 1 and 20. | | portNumber | number | Port number. Must be a positive integer. |
**Returns:** **Returns:**

@ -58,7 +58,7 @@ export async function main(ns) {
| [brutessh(host)](./bitburner.ns.brutessh.md) | Runs BruteSSH.exe on a server. | | [brutessh(host)](./bitburner.ns.brutessh.md) | Runs BruteSSH.exe on a server. |
| [clear(handle)](./bitburner.ns.clear.md) | Clear data from a file. | | [clear(handle)](./bitburner.ns.clear.md) | Clear data from a file. |
| [clearLog()](./bitburner.ns.clearlog.md) | Clears the scripts logs. | | [clearLog()](./bitburner.ns.clearlog.md) | Clears the scripts logs. |
| [clearPort(handle)](./bitburner.ns.clearport.md) | Clear data from a port. | | [clearPort(portNumber)](./bitburner.ns.clearport.md) | Clear data from a port. |
| [closeTail(pid)](./bitburner.ns.closetail.md) | Close the tail window of a script. | | [closeTail(pid)](./bitburner.ns.closetail.md) | Close the tail window of a script. |
| [deleteServer(host)](./bitburner.ns.deleteserver.md) | Delete a purchased server. | | [deleteServer(host)](./bitburner.ns.deleteserver.md) | Delete a purchased server. |
| [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given function. | | [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given function. |

@ -16,7 +16,7 @@ peek(portNumber: number): PortData;
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| portNumber | number | Port to peek. Must be an integer between 1 and 20. | | portNumber | number | Port to peek. Must be a positive integer. |
**Returns:** **Returns:**

@ -16,7 +16,7 @@ readPort(portNumber: number): PortData;
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| portNumber | number | | | portNumber | number | Port to read from. Must be a positive integer. |
**Returns:** **Returns:**

@ -16,7 +16,7 @@ tryWritePort(portNumber: number, data: string | number): boolean;
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| portNumber | number | Port or text file that will be written to. | | portNumber | number | Port to attempt to write to to. Must be a positive integer. |
| data | string \| number | Data to write. | | data | string \| number | Data to write. |
**Returns:** **Returns:**

@ -16,7 +16,7 @@ writePort(portNumber: number, data: string | number): PortData | null;
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| portNumber | number | | | portNumber | number | Port to write to. Must be a positive integer. |
| data | string \| number | | | data | string \| number | |
**Returns:** **Returns:**

@ -6056,7 +6056,7 @@ export interface NS {
* If the port is full, the data will not be written. * If the port is full, the data will not be written.
* Otherwise, the data will be written normally. * Otherwise, the data will be written normally.
* *
* @param portNumber - Port or text file that will be written to. * @param portNumber - Port to attempt to write to to. Must be a positive integer.
* @param data - Data to write. * @param data - Data to write.
* @returns True if the data is successfully written to the port, and false otherwise. * @returns True if the data is successfully written to the port, and false otherwise.
*/ */
@ -6086,7 +6086,7 @@ export interface NS {
* first element in the specified port without removing that element. If * first element in the specified port without removing that element. If
* the port is empty, the string NULL PORT DATA will be returned. * the port is empty, the string NULL PORT DATA will be returned.
* *
* @param portNumber - Port to peek. Must be an integer between 1 and 20. * @param portNumber - Port to peek. Must be a positive integer.
* @returns Data in the specified port. * @returns Data in the specified port.
*/ */
peek(portNumber: number): PortData; peek(portNumber: number): PortData;
@ -6109,9 +6109,9 @@ export interface NS {
* *
* Delete all data from the underlying queue. * Delete all data from the underlying queue.
* *
* @param handle - Port to clear. * @param portNumber - Port to clear data from. Must be a positive integer.
*/ */
clearPort(handle: number): void; clearPort(portNumber: number): void;
/** /**
* Write data to a port. * Write data to a port.
@ -6119,6 +6119,7 @@ export interface NS {
* RAM cost: 0 GB * RAM cost: 0 GB
* *
* Write data to the given Netscript port. * Write data to the given Netscript port.
* @param portNumber - Port to write to. Must be a positive integer.
* @returns The data popped off the queue if it was full, or null if it was not full. * @returns The data popped off the queue if it was full, or null if it was not full.
*/ */
writePort(portNumber: number, data: string | number): PortData | null; writePort(portNumber: number, data: string | number): PortData | null;
@ -6130,6 +6131,7 @@ export interface NS {
* Read data from that port. A port is a serialized queue. * Read data from that port. A port is a serialized queue.
* This function will remove the first element from that queue and return it. * This function will remove the first element from that queue and return it.
* If the queue is empty, then the string NULL PORT DATA will be returned. * If the queue is empty, then the string NULL PORT DATA will be returned.
* @param portNumber - Port to read from. Must be a positive integer.
* @returns The data read. * @returns The data read.
*/ */
readPort(portNumber: number): PortData; readPort(portNumber: number): PortData;
@ -6143,7 +6145,7 @@ export interface NS {
* *
* WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0. * WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0.
* *
* @param portNumber - Port number. Must be an integer between 1 and 20. * @param portNumber - Port number. Must be a positive integer.
*/ */
getPortHandle(portNumber: number): NetscriptPort; getPortHandle(portNumber: number): NetscriptPort;