** Push on the stack the contents of table 'arg' from 1 to #arg */
| 204 | ** Push on the stack the contents of table 'arg' from 1 to #arg |
| 205 | */ |
| 206 | static int pushargs (lua_State *L) { |
| 207 | int i, n; |
| 208 | if (lua_getglobal(L, "arg") != LUA_TTABLE) |
| 209 | luaL_error(L, "'arg' is not a table"); |
| 210 | n = (int)luaL_len(L, -1); |
| 211 | luaL_checkstack(L, n + 3, "too many arguments to script"); |
| 212 | for (i = 1; i <= n; i++) |
| 213 | lua_rawgeti(L, -i, i); |
| 214 | lua_remove(L, -i); /* remove table from the stack */ |
| 215 | return n; |
| 216 | } |
| 217 | |
| 218 | |
| 219 | static int handle_script (lua_State *L, char **argv) { |
no test coverage detected