** Create a vararg table at the top of the stack, with 'n' elements ** starting at 'f'. */
| 229 | ** starting at 'f'. |
| 230 | */ |
| 231 | static void createvarargtab (lua_State *L, StkId f, int n) { |
| 232 | int i; |
| 233 | TValue key, value; |
| 234 | Table *t = luaH_new(L); |
| 235 | sethvalue(L, s2v(L->top.p), t); |
| 236 | L->top.p++; |
| 237 | luaH_resize(L, t, cast_uint(n), 1); |
| 238 | setsvalue(L, &key, luaS_new(L, "n")); /* key is "n" */ |
| 239 | setivalue(&value, n); /* value is n */ |
| 240 | /* No need to anchor the key: Due to the resize, the next operation |
| 241 | cannot trigger a garbage collection */ |
| 242 | luaH_set(L, t, &key, &value); /* t.n = n */ |
| 243 | for (i = 0; i < n; i++) |
| 244 | luaH_setint(L, t, i + 1, s2v(f + i)); |
| 245 | luaC_checkGC(L); |
| 246 | } |
| 247 | |
| 248 | |
| 249 | /* |
no test coverage detected