| 237 | |
| 238 | |
| 239 | static int handle_script (lua_State *L, char **argv, int n) { |
| 240 | int status; |
| 241 | const char *fname; |
| 242 | int narg = getargs(L, argv, n); /* collect arguments */ |
| 243 | lua_setglobal(L, "arg"); |
| 244 | fname = argv[n]; |
| 245 | if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) |
| 246 | fname = NULL; /* stdin */ |
| 247 | status = luaL_loadfile(L, fname); |
| 248 | lua_insert(L, -(narg+1)); |
| 249 | if (status == 0) |
| 250 | status = docall(L, narg, 0); |
| 251 | else |
| 252 | lua_pop(L, narg); |
| 253 | return report(L, status); |
| 254 | } |
| 255 | |
| 256 | |
| 257 | /* check that argument has no extra characters at the end */ |
no test coverage detected