summaryrefslogtreecommitdiff
path: root/src/lbaselib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-23 08:33:41 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-23 08:45:34 +0100
commit99564913987698cdfc2528a93b5157030e637ced (patch)
tree49963f4e7358367cb3c6a4a5784cb1dd6c97de33 /src/lbaselib.js
parent9e08fa3a4b9f8848bb4eac3e745079282099a3d8 (diff)
downloadfengari-99564913987698cdfc2528a93b5157030e637ced.tar.gz
fengari-99564913987698cdfc2528a93b5157030e637ced.tar.bz2
fengari-99564913987698cdfc2528a93b5157030e637ced.zip
dofile
Diffstat (limited to 'src/lbaselib.js')
-rw-r--r--src/lbaselib.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lbaselib.js b/src/lbaselib.js
index 604a005..83b3c33 100644
--- a/src/lbaselib.js
+++ b/src/lbaselib.js
@@ -358,7 +358,21 @@ if (typeof window === "undefined") {
return load_aux(L, status, env);
};
+ const dofilecont = function(L, d1, d2) {
+ return lapi.lua_gettop(L) - 1;
+ };
+
+ const luaB_dofile = function(L) {
+ let fname = lauxlib.luaL_optstring(L, 1, null);
+ lapi.lua_settop(L, 1);
+ if (lauxlib.luaL_loadfile(L, fname) !== TS.LUA_OK)
+ return lapi.lua_error(L);
+ lapi.lua_callk(L, 0, lua.LUA_MULTRET, 0, dofilecont);
+ return dofilecont(L, 0, 0);
+ };
+
base_funcs.loadfile = luaB_loadfile;
+ base_funcs.dofile = luaB_dofile;
}