** Processes options 'e' and 'l', which involve running Lua code. ** Returns 0 if some code raises an error. */
| 235 | ** Returns 0 if some code raises an error. |
| 236 | */ |
| 237 | static int runargs(lua_State *L, char **argv, int n) { |
| 238 | int i; |
| 239 | for (i = 1; i < n; i++) { |
| 240 | int option = argv[i][1]; |
| 241 | lua_assert(argv[i][0] == '-'); /* already checked */ |
| 242 | if (option == 'e' || option == 'l') { |
| 243 | int status; |
| 244 | const char *extra = argv[i] + 2; /* both options need an argument */ |
| 245 | if (*extra == '\0') extra = argv[++i]; |
| 246 | lua_assert(extra != nullptr); |
| 247 | status = (option == 'e') |
| 248 | ? dostring(L, extra, "=(command line)") |
| 249 | : dolibrary(L, extra); |
| 250 | if (status != LUA_OK) return 0; |
| 251 | } |
| 252 | } |
| 253 | return 1; |
| 254 | } |
| 255 | |
| 256 | static int handle_script(lua_State *L, char **argv) { |
| 257 | // READ THIS |