Fix args for ns1

This commit is contained in:
omuretsu 2023-01-02 17:56:11 -05:00
parent 9820f9e24a
commit 70b8be9988

@ -82,6 +82,7 @@ async function startNetscript1Script(workerScript: WorkerScript): Promise<void>
//TODO unplanned: Make NS1 wrapping type safe instead of using BasicObject. //TODO unplanned: Make NS1 wrapping type safe instead of using BasicObject.
type BasicObject = Record<string, any>; type BasicObject = Record<string, any>;
function wrapNS1Layer(int: Interpreter, intLayer: unknown, nsLayer = wrappedNS as BasicObject) { function wrapNS1Layer(int: Interpreter, intLayer: unknown, nsLayer = wrappedNS as BasicObject) {
if (nsLayer === wrappedNS) int.setProperty(intLayer, "args", int.nativeToPseudo(workerScript.args));
for (const [name, entry] of Object.entries(nsLayer)) { for (const [name, entry] of Object.entries(nsLayer)) {
if (typeof entry === "function") { if (typeof entry === "function") {
const wrapper = async (...args: unknown[]) => { const wrapper = async (...args: unknown[]) => {