DOC: Fix outdated example for ns.spawn() (#1101)

This commit is contained in:
adeilt 2024-02-15 20:44:25 -08:00 committed by GitHub
parent ef334cb851
commit 22aec2a8b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

@ -17,7 +17,7 @@ spawn(script: string, threadOrOptions?: number | SpawnOptions, ...args: (string
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| script | string | Filename of script to execute. | | script | string | Filename of script to execute. |
| threadOrOptions | number \| [SpawnOptions](./bitburner.spawnoptions.md) | _(Optional)_ Either an integer number of threads for new script, or a [SpawnOptions](./bitburner.spawnoptions.md) object. Threads defaults to 1. | | threadOrOptions | number \| [SpawnOptions](./bitburner.spawnoptions.md) | _(Optional)_ Either an integer number of threads for new script, or a [SpawnOptions](./bitburner.spawnoptions.md) object. Threads defaults to 1 and spawnDelay defaults to 10,000 ms. |
| args | (string \| number \| boolean)\[\] | Additional arguments to pass into the new script that is being run. | | args | (string \| number \| boolean)\[\] | Additional arguments to pass into the new script that is being run. |
**Returns:** **Returns:**
@ -39,6 +39,6 @@ Running this function with 0 or fewer threads will cause a runtime error.
```js ```js
//The following example will execute the script foo.js with 10 threads, in 500 milliseconds and the arguments foodnstuff and 90: //The following example will execute the script foo.js with 10 threads, in 500 milliseconds and the arguments foodnstuff and 90:
ns.spawn('foo.js', 10, 500, 'foodnstuff', 90); ns.spawn('foo.js', {threads: 10, spawnDelay: 500}, 'foodnstuff', 90);
``` ```

@ -6054,10 +6054,10 @@ export interface NS {
* @example * @example
* ```js * ```js
* //The following example will execute the script foo.js with 10 threads, in 500 milliseconds and the arguments foodnstuff and 90: * //The following example will execute the script foo.js with 10 threads, in 500 milliseconds and the arguments foodnstuff and 90:
* ns.spawn('foo.js', 10, 500, 'foodnstuff', 90); * ns.spawn('foo.js', {threads: 10, spawnDelay: 500}, 'foodnstuff', 90);
* ``` * ```
* @param script - Filename of script to execute. * @param script - Filename of script to execute.
* @param threadOrOptions - Either an integer number of threads for new script, or a {@link SpawnOptions} object. Threads defaults to 1. * @param threadOrOptions - Either an integer number of threads for new script, or a {@link SpawnOptions} object. Threads defaults to 1 and spawnDelay defaults to 10,000 ms.
* @param args - Additional arguments to pass into the new script that is being run. * @param args - Additional arguments to pass into the new script that is being run.
*/ */
spawn(script: string, threadOrOptions?: number | SpawnOptions, ...args: (string | number | boolean)[]): void; spawn(script: string, threadOrOptions?: number | SpawnOptions, ...args: (string | number | boolean)[]): void;