fix netscript port read not correctly converting ns1 objects

This commit is contained in:
Olivier Gagnon
2021-10-05 16:37:54 -04:00
parent a420a87eba
commit 75a2742911
4 changed files with 8 additions and 5 deletions
+6 -2
View File
@@ -2396,7 +2396,9 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
if (iport == null || !(iport instanceof Object)) {
throw makeRuntimeErrorMsg("read", `Could not find port: ${port}. This is a bug. Report to dev.`);
}
return iport.read();
const x = iport.read();
console.log(x);
return x;
} else if (isString(port)) {
// Read from script or text file
const fn = port;
@@ -2443,7 +2445,9 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
if (iport == null || !(iport instanceof Object)) {
throw makeRuntimeErrorMsg("peek", `Could not find port: ${port}. This is a bug. Report to dev.`);
}
return iport.peek();
const x = iport.peek();
console.log(x);
return x;
},
clear: function (port: any): any {
updateDynamicRam("clear", getRamCost("clear"));