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

Function runargs

third-party/lua-5.4.6/src/lua.c:348–371  ·  view source on GitHub ↗

** Processes options 'e' and 'l', which involve running Lua code, and ** 'W', which also affects the state. ** Returns 0 if some code raises an error. */

Source from the content-addressed store, hash-verified

346** Returns 0 if some code raises an error.
347*/
348static int runargs (lua_State *L, char **argv, int n) {
349 int i;
350 for (i = 1; i < n; i++) {
351 int option = argv[i][1];
352 lua_assert(argv[i][0] == '-'); /* already checked */
353 switch (option) {
354 case 'e': case 'l': {
355 int status;
356 char *extra = argv[i] + 2; /* both options need an argument */
357 if (*extra == '\0') extra = argv[++i];
358 lua_assert(extra != NULL);
359 status = (option == 'e')
360 ? dostring(L, extra, "=(command line)")
361 : dolibrary(L, extra);
362 if (status != LUA_OK) return 0;
363 break;
364 }
365 case 'W':
366 lua_warning(L, "@on", 0); /* warnings on */
367 break;
368 }
369 }
370 return 1;
371}
372
373
374static int handle_luainit (lua_State *L) {

Callers 1

pmainFunction · 0.70

Calls 3

dostringFunction · 0.70
dolibraryFunction · 0.70
lua_warningFunction · 0.70

Tested by

no test coverage detected