static int ldelvars(lua_State *L) { struct vars ** box = (struct vars **)lua_touserdata(L,1); if (*box) { lbind_delete(*box); *box = NULL; } return 0; }
static int Ltimer_delete(lua_State *L) { lzn_Timer *obj = (lzn_Timer*)lbind_test(L, 1, &lbT_Timer); if (obj->timer != NULL) { zn_deltimer(obj->timer); lbind_delete(L, 1); lzn_unref(L, &obj->ontimer_ref); lzn_unref(L, &obj->ref); obj->timer = NULL; } return 0; }
static int Lgc(lua_State *L) { lbind_Object *obj = (lbind_Object*)lua_touserdata(L, 1); if (obj != NULL && check_size(L, 1)) { if ((obj->o.flags & LBIND_TRACK) != 0) { lua_getfield(L, 1, "delete"); if (!lua_isnil(L, -1)) { lua_pushvalue(L, 1); lua_call(L, 1, 0); } if ((obj->o.flags & LBIND_TRACK) != 0) lbind_delete(L, 1); } } return 0; }
static int Ldelete(lua_State *L) { int i, top = lua_gettop(L); for (i = 1; i <= top; ++i) { lua_getfield(L, i, "delete"); if (!lua_isnil(L, -1)) { lua_pushvalue(L, i); lua_call(L, 1, 0); } else { lua_pop(L, 1); lbind_delete(L, i); } } return 0; }