FFI: Add ffi.gc() function for finalization of cdata objects.

This commit is contained in:
Mike Pall
2011-02-28 16:48:13 +01:00
parent cead25f928
commit 83a37aeca7
9 changed files with 191 additions and 57 deletions

View File

@@ -540,7 +540,7 @@ GCstr *lj_ctype_repr_complex(lua_State *L, void *sp, CTSize size)
/* -- C type state -------------------------------------------------------- */
/* Initialize C type table and state. */
void lj_ctype_init(lua_State *L)
CTState *lj_ctype_init(lua_State *L)
{
CTState *cts = lj_mem_newt(L, sizeof(CTState), CTState);
CType *ct = lj_mem_newvec(L, CTTYPETAB_MIN, CType);
@@ -568,6 +568,7 @@ void lj_ctype_init(lua_State *L)
}
}
setmref(G(L)->ctype_state, cts);
return cts;
}
/* Free C type table and state. */