| 114 | |
| 115 | |
| 116 | static int getargs (lua_State *L, char **argv, int n) { |
| 117 | int narg; |
| 118 | int i; |
| 119 | int argc = 0; |
| 120 | while (argv[argc]) argc++; /* count total number of arguments */ |
| 121 | narg = argc - (n + 1); /* number of arguments to the script */ |
| 122 | luaL_checkstack(L, narg + 3, "too many arguments to script"); |
| 123 | for (i=n+1; i < argc; i++) |
| 124 | lua_pushstring(L, argv[i]); |
| 125 | lua_createtable(L, narg, n + 1); |
| 126 | for (i=0; i < argc; i++) { |
| 127 | lua_pushstring(L, argv[i]); |
| 128 | lua_rawseti(L, -2, i - n); |
| 129 | } |
| 130 | return narg; |
| 131 | } |
| 132 | |
| 133 | |
| 134 | static int dofile (lua_State *L, const char *name) { |
no test coverage detected