Add table.clear().

This commit is contained in:
Mike Pall
2013-11-25 15:18:31 +01:00
parent c378f7dbb8
commit 4593fb5e29
8 changed files with 62 additions and 2 deletions

View File

@@ -204,6 +204,17 @@ GCtab * LJ_FASTCALL lj_tab_dup(lua_State *L, const GCtab *kt)
return t;
}
/* Clear a table. */
void LJ_FASTCALL lj_tab_clear(GCtab *t)
{
clearapart(t);
if (t->hmask > 0) {
Node *node = noderef(t->node);
setmref(node->freetop, &node[t->hmask+1]);
clearhpart(t);
}
}
/* Free a table. */
void LJ_FASTCALL lj_tab_free(global_State *g, GCtab *t)
{