mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
Remove mention of accessing underlying port data array from .rst file
Fixes #2201
This commit is contained in:
parent
3276cf3c32
commit
ad71e5513c
@ -66,8 +66,7 @@ And the data in port 1 will look like::
|
|||||||
WARNING: Port Handles only work in :ref:`netscriptjs`. They do not work in :ref:`netscript1`
|
WARNING: Port Handles only work in :ref:`netscriptjs`. They do not work in :ref:`netscript1`
|
||||||
|
|
||||||
The :js:func:`getPortHandle` Netscript function can be used to get a handle to a Netscript Port.
|
The :js:func:`getPortHandle` Netscript function can be used to get a handle to a Netscript Port.
|
||||||
This handle allows you to access several new port-related functions and the
|
This handle allows you to access several new port-related functions. The functions are:
|
||||||
port's underlying data structure, which is just a JavaScript array. The functions are:
|
|
||||||
|
|
||||||
.. js:method:: NetscriptPort.writePort(data)
|
.. js:method:: NetscriptPort.writePort(data)
|
||||||
|
|
||||||
@ -111,22 +110,11 @@ port's underlying data structure, which is just a JavaScript array. The function
|
|||||||
|
|
||||||
Clears all data from the port. Works the same as the Netscript function `clear`
|
Clears all data from the port. Works the same as the Netscript function `clear`
|
||||||
|
|
||||||
.. js:attribute:: NetscriptPort.data
|
|
||||||
|
|
||||||
The Netscript port underlying data structure, which is just a Javascript array. All
|
|
||||||
valid Javascript Array methods can be called on this.
|
|
||||||
|
|
||||||
Port Handle Example::
|
Port Handle Example::
|
||||||
|
|
||||||
port = getPortHandle(5);
|
port = getPortHandle(5);
|
||||||
back = port.data.pop(); //Get and remove last element in port
|
back = port.data.pop(); //Get and remove last element in port
|
||||||
|
|
||||||
//Remove an element from the port
|
|
||||||
i = port.data.findIndex("foo");
|
|
||||||
if (i != -1) {
|
|
||||||
port.data.slice(i, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Wait for port data before reading
|
//Wait for port data before reading
|
||||||
while(port.empty()) {
|
while(port.empty()) {
|
||||||
sleep(10000);
|
sleep(10000);
|
||||||
|
Loading…
Reference in New Issue
Block a user