** Push on the stack the contents of table 'arg' from 1 to #arg */
| 243 | ** Push on the stack the contents of table 'arg' from 1 to #arg |
| 244 | */ |
| 245 | static int pushargs (lua_State *L) { |
| 246 | int i, n; |
| 247 | if (lua_getglobal(L, "arg") != LUA_TTABLE) |
| 248 | luaL_error(L, "'arg' is not a table"); |
| 249 | n = (int)luaL_len(L, -1); |
| 250 | luaL_checkstack(L, n + 3, "too many arguments to script"); |
| 251 | for (i = 1; i <= n; i++) |
| 252 | lua_rawgeti(L, -i, i); |
| 253 | lua_remove(L, -i); /* remove table from the stack */ |
| 254 | return n; |
| 255 | } |
| 256 | |
| 257 | |
| 258 | static int handle_script (lua_State *L, char **argv) { |
no test coverage detected