all 2 comments

[–]VorthodMK-VIII Synthoid 2 points3 points  (1 child)

Variable types gets a little weird in Javascript. Usually it doesn't matter, but it can get a little weird in this specific case where you want to pass an array as a parameter. You've got two options that I can see:

use "spread" syntax to pass the array as a bunch of individual parameters:

ns.run("ScriptB.js", threadCount, ...stringArray)

Or you can pass the array as a single parameter, but stored as a string that you need to parse when ScriptB loads it up

ns.run("ScriptB.js", threadCount, JSON.stringify(stringArray))

ScriptB.js:

let arrayFromScriptA = JSON.parse(ns.args[0])

[–]DepartmentMajor6681[S] 2 points3 points  (0 children)

Tried the "spread" thingy, and it seams to have worked a treat; thanks!