From 66ac31ee9962033471414d75f096d335fad5c98d Mon Sep 17 00:00:00 2001 From: muesli4brekkies <110121045+muesli4brekkies@users.noreply.github.com> Date: Sat, 2 Sep 2023 15:57:31 +0100 Subject: [PATCH] DOCS: Improve/correct some API docs related to ports (#772) --- markdown/bitburner.ns.clearport.md | 4 ++-- markdown/bitburner.ns.getporthandle.md | 2 +- markdown/bitburner.ns.md | 2 +- markdown/bitburner.ns.peek.md | 2 +- markdown/bitburner.ns.readport.md | 2 +- markdown/bitburner.ns.trywriteport.md | 2 +- markdown/bitburner.ns.writeport.md | 2 +- src/ScriptEditor/NetscriptDefinitions.d.ts | 12 +++++++----- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/markdown/bitburner.ns.clearport.md b/markdown/bitburner.ns.clearport.md index 84d44a9a8..3d36f6d23 100644 --- a/markdown/bitburner.ns.clearport.md +++ b/markdown/bitburner.ns.clearport.md @@ -9,14 +9,14 @@ Clear data from a port. **Signature:** ```typescript -clearPort(handle: number): void; +clearPort(portNumber: number): void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| handle | number | Port to clear. | +| portNumber | number | Port to clear data from. Must be a positive integer. | **Returns:** diff --git a/markdown/bitburner.ns.getporthandle.md b/markdown/bitburner.ns.getporthandle.md index f7677b193..2aac1764a 100644 --- a/markdown/bitburner.ns.getporthandle.md +++ b/markdown/bitburner.ns.getporthandle.md @@ -16,7 +16,7 @@ getPortHandle(portNumber: number): NetscriptPort; | 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:** diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index 2625724b1..ae4a00ed1 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -58,7 +58,7 @@ export async function main(ns) { | [brutessh(host)](./bitburner.ns.brutessh.md) | Runs BruteSSH.exe on a server. | | [clear(handle)](./bitburner.ns.clear.md) | Clear data from a file. | | [clearLog()](./bitburner.ns.clearlog.md) | Clears the script’s 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. | | [deleteServer(host)](./bitburner.ns.deleteserver.md) | Delete a purchased server. | | [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given function. | diff --git a/markdown/bitburner.ns.peek.md b/markdown/bitburner.ns.peek.md index a6a831c72..34cc10586 100644 --- a/markdown/bitburner.ns.peek.md +++ b/markdown/bitburner.ns.peek.md @@ -16,7 +16,7 @@ peek(portNumber: number): PortData; | 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:** diff --git a/markdown/bitburner.ns.readport.md b/markdown/bitburner.ns.readport.md index 28f60249f..84a7bb51a 100644 --- a/markdown/bitburner.ns.readport.md +++ b/markdown/bitburner.ns.readport.md @@ -16,7 +16,7 @@ readPort(portNumber: number): PortData; | Parameter | Type | Description | | --- | --- | --- | -| portNumber | number | | +| portNumber | number | Port to read from. Must be a positive integer. | **Returns:** diff --git a/markdown/bitburner.ns.trywriteport.md b/markdown/bitburner.ns.trywriteport.md index af82ce3c1..edbe3234c 100644 --- a/markdown/bitburner.ns.trywriteport.md +++ b/markdown/bitburner.ns.trywriteport.md @@ -16,7 +16,7 @@ tryWritePort(portNumber: number, data: string | number): boolean; | 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. | **Returns:** diff --git a/markdown/bitburner.ns.writeport.md b/markdown/bitburner.ns.writeport.md index a7c0a8395..a19734e10 100644 --- a/markdown/bitburner.ns.writeport.md +++ b/markdown/bitburner.ns.writeport.md @@ -16,7 +16,7 @@ writePort(portNumber: number, data: string | number): PortData | null; | Parameter | Type | Description | | --- | --- | --- | -| portNumber | number | | +| portNumber | number | Port to write to. Must be a positive integer. | | data | string \| number | | **Returns:** diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 77ef28a94..28ac48775 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6056,7 +6056,7 @@ export interface NS { * If the port is full, the data will not be written. * 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. * @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 * 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. */ peek(portNumber: number): PortData; @@ -6109,9 +6109,9 @@ export interface NS { * * 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. @@ -6119,6 +6119,7 @@ export interface NS { * RAM cost: 0 GB * * 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. */ 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. * 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. + * @param portNumber - Port to read from. Must be a positive integer. * @returns The data read. */ 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. * - * @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;