From 84858c335ed5fe584c7c731f5090f8175f66a675 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 3 Sep 2018 19:37:55 +0200 Subject: [PATCH] mujs shell: Make the load function behave like in the SpiderMonkey shell. --- main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 2aff317..e99770e 100644 --- a/main.c +++ b/main.c @@ -93,9 +93,14 @@ static void jsB_gc(js_State *J) static void jsB_load(js_State *J) { - const char *filename = js_tostring(J, 1); - int rv = js_dofile(J, filename); - js_pushboolean(J, !rv); + int i, n = js_gettop(J); + for (i = 1; i < n; ++i) { + js_loadfile(J, js_tostring(J, i)); + js_pushundefined(J); + js_call(J, 0); + js_pop(J, 1); + } + js_pushundefined(J); } static void jsB_print(js_State *J)