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