MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / runargs

Function runargs

src/Chain/libraries/glua/lua.cpp:513–530  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

511** Returns 0 if some code raises an error.
512*/
513static int runargs(lua_State *L, char **argv, int n) {
514 int i;
515 for (i = 1; i < n; i++) {
516 int option = argv[i][1];
517 lua_assert(argv[i][0] == '-'); /* already checked */
518 if (option == 'e' || option == 'l') {
519 int status;
520 const char *extra = argv[i] + 2; /* both options need an argument */
521 if (*extra == '\0') extra = argv[++i];
522 lua_assert(extra != nullptr);
523 status = (option == 'e')
524 ? dostring(L, extra, "=(command line)")
525 : dolibrary(L, extra);
526 if (status != LUA_OK) return 0;
527 }
528 }
529 return 1;
530}
531
532
533static int handle_luainit(lua_State *L) {

Callers 1

pmainFunction · 0.70

Calls 2

dostringFunction · 0.70
dolibraryFunction · 0.70

Tested by

no test coverage detected