mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Test for lua_getuserdatadtor
This commit is contained in:
parent
6a30fe2fe4
commit
b34eeb0183
1 changed files with 5 additions and 2 deletions
|
@ -1301,9 +1301,12 @@ TEST_CASE("UserdataApi")
|
|||
lua_State* L = globalState.get();
|
||||
|
||||
// setup dtor for tag 42 (created later)
|
||||
lua_setuserdatadtor(L, 42, [](lua_State* l, void* data) {
|
||||
auto dtor = [](lua_State* l, void* data) {
|
||||
dtorhits += *(int*)data;
|
||||
});
|
||||
};
|
||||
CHECK((void*)lua_getuserdatadtor(L, 42) == nullptr); // (void*) silences warning C4180 on VS 2017
|
||||
lua_setuserdatadtor(L, 42, dtor);
|
||||
CHECK((void*)lua_getuserdatadtor(L, 42) == dtor);
|
||||
|
||||
// light user data
|
||||
int lud;
|
||||
|
|
Loading…
Add table
Reference in a new issue