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

Function runargs

third-party/lua-5.5.0/src/lua.c:350–374  ·  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

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

Callers 1

pmainFunction · 0.70

Calls 3

lua_warningFunction · 0.70
dostringFunction · 0.70
dolibraryFunction · 0.70

Tested by

no test coverage detected