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