| 324 | |
| 325 | |
| 326 | static int handle_script (lua_State *L, char **argv, int n) { |
| 327 | int status; |
| 328 | const char *fname; |
| 329 | int narg = getargs(L, argv, n); /* collect arguments */ |
| 330 | lua_setglobal(L, "arg"); |
| 331 | fname = argv[n]; |
| 332 | if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) |
| 333 | fname = NULL; /* stdin */ |
| 334 | status = luaL_loadfile(L, fname); |
| 335 | lua_insert(L, -(narg+1)); |
| 336 | if (status == LUA_OK) |
| 337 | status = docall(L, narg, LUA_MULTRET); |
| 338 | else |
| 339 | lua_pop(L, narg); |
| 340 | return report(L, status); |
| 341 | } |
| 342 | |
| 343 | |
| 344 | /* check that argument has no extra characters at the end */ |
no test coverage detected