MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / createargtable

Function createargtable

third-party/lua-5.5.0/src/lua.c:185–194  ·  view source on GitHub ↗

** Create the 'arg' table, which stores all arguments from the ** command line ('argv'). It should be aligned so that, at index 0, ** it has 'argv[script]', which is the script name. The arguments ** to the script (everything after 'script') go to positive indices; ** other arguments (before the script name) go to negative indices. ** If there is no script name, assume interpreter's name as base.

Source from the content-addressed store, hash-verified

183** table sizes are zero.)
184*/
185static void createargtable (lua_State *L, char **argv, int argc, int script) {
186 int i, narg;
187 narg = argc - (script + 1); /* number of positive indices */
188 lua_createtable(L, narg, script + 1);
189 for (i = 0; i < argc; i++) {
190 lua_pushstring(L, argv[i]);
191 lua_rawseti(L, -2, i - script);
192 }
193 lua_setglobal(L, "arg");
194}
195
196
197static int dochunk (lua_State *L, int status) {

Callers 1

pmainFunction · 0.70

Calls 4

lua_createtableFunction · 0.70
lua_pushstringFunction · 0.70
lua_rawsetiFunction · 0.70
lua_setglobalFunction · 0.70

Tested by

no test coverage detected