mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-07 19:14:37 +01:00
Merge pull request #4224 from quacksouls/doc-scan
DOC: `ns.scan()`: typo fixes and add 2 examples
This commit is contained in:
39
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
39
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -5194,8 +5194,43 @@ export interface NS {
|
||||
* node way from the specified target server. The hostnames in the returned
|
||||
* array are strings.
|
||||
*
|
||||
* @param host - Optional, Hostname of the server to scan, default to current server.
|
||||
* @returns Returns an string of hostnames.
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS1
|
||||
* // All servers that are one hop from the current server.
|
||||
* tprint("Neighbors of current server.");
|
||||
* var neighbor = scan();
|
||||
* for (var i = 0; i < neighbor.length; i++) {
|
||||
* tprint(neighbor[i]);
|
||||
* }
|
||||
* // All neighbors of n00dles.
|
||||
* var target = "n00dles";
|
||||
* neighbor = scan(target);
|
||||
* tprintf("Neighbors of %s.", target);
|
||||
* for (var i = 0; i < neighbor.length; i++) {
|
||||
* tprint(neighbor[i]);
|
||||
* }
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS2
|
||||
* // All servers that are one hop from the current server.
|
||||
* ns.tprint("Neighbors of current server.");
|
||||
* let neighbor = ns.scan();
|
||||
* for (let i = 0; i < neighbor.length; i++) {
|
||||
* ns.tprint(neighbor[i]);
|
||||
* }
|
||||
* // All neighbors of n00dles.
|
||||
* const target = "n00dles";
|
||||
* neighbor = ns.scan(target);
|
||||
* ns.tprintf("Neighbors of %s.", target);
|
||||
* for (let i = 0; i < neighbor.length; i++) {
|
||||
* ns.tprint(neighbor[i]);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param host - Optional. Hostname of the server to scan, default to current server.
|
||||
* @returns Returns an array of hostnames.
|
||||
*/
|
||||
scan(host?: string): string[];
|
||||
|
||||
|
Reference in New Issue
Block a user