** Push on the stack the contents of table 'arg' from 1 to #arg */
| 139 | ** Push on the stack the contents of table 'arg' from 1 to #arg |
| 140 | */ |
| 141 | static int pushargs(lua_State *L) { |
| 142 | int i, n; |
| 143 | if (lua_getglobal(L, "arg") != LUA_TTABLE) |
| 144 | luaL_error(L, "'arg' is not a table"); |
| 145 | n = (int)luaL_len(L, -1); |
| 146 | luaL_checkstack(L, n + 3, "too many arguments to script"); |
| 147 | for (i = 1; i <= n; i++) |
| 148 | lua_rawgeti(L, -i, i); |
| 149 | lua_remove(L, -i); /* remove table from the stack */ |
| 150 | return n; |
| 151 | } |
| 152 | |
| 153 | |
| 154 |
no test coverage detected