summaryrefslogtreecommitdiff
path: root/tests/manual-tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual-tests')
-rwxr-xr-xtests/manual-tests/lua-cli.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/manual-tests/lua-cli.js b/tests/manual-tests/lua-cli.js
index e32067e..0b097f8 100755
--- a/tests/manual-tests/lua-cli.js
+++ b/tests/manual-tests/lua-cli.js
@@ -14,8 +14,18 @@ const _PROMPT2 = lua.to_luastring("_PROMPT2");
const L = lauxlib.luaL_newstate();
+let script = 2; // Where to start args from
+
linit.luaL_openlibs(L);
+/* create 'arg' table */
+lapi.lua_createtable(L, process.argv.length - (script + 1), script + 1);
+for (let i = 0; i < process.argv.length; i++) {
+ lapi.lua_pushliteral(L, process.argv[i]);
+ lapi.lua_seti(L, -2, i - script); /* TODO: rawseti */
+}
+lapi.lua_setglobal(L, lua.to_luastring("arg"));
+
let init = process.env["LUA_INIT"+lua.LUA_VERSUFFIX] || process.env["LUA_INIT"];
if (init) {
let status;