|
Xianfu Pan <pxfgod@gmail.com>于2017年1月11日周三 上午10:03写道: and `luaC_resettable` is implemented as follows in "lgc.c"`void luaC_resettable(lua_State *L, Table *h) {/*need not to barrierback, because new value is NIL*/Node *n, *limit = gnodelast(h);unsigned int i;for (i = 0; i < h->sizearray; i++){TValue *cell = &h->array[i];setnilvalue(cell);}for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */TValue *cell = gval(n);if (!ttisnil(cell))setnilvalue(cell);}}`Are there any issues/pitfalls of my implementation. Or any advices for me?Many thanks.I think you can call luaH_resize(L, h, 0, 0) instead of luaC_resettable you implement.