| 232 | ((skr::SObjectPtr<skr::SInterface>*)((char*)p + sizeof(void*)))->reset(); |
| 233 | } |
| 234 | void bind_unknown(lua_State* L) |
| 235 | { |
| 236 | luaL_Reg metamethods[] = { |
| 237 | { "__eq", [](lua_State* L) -> int { |
| 238 | void* a = *(void**)lua_touserdata(L, 1); |
| 239 | void* b = *(void**)lua_touserdata(L, 2); |
| 240 | lua_pushboolean(L, a == b); |
| 241 | return 1; |
| 242 | } }, |
| 243 | { nullptr, nullptr } |
| 244 | }; |
| 245 | luaL_newmetatable(L, "skr_opaque_t"); |
| 246 | luaL_register(L, nullptr, metamethods); |
| 247 | lua_pop(L, 1); |
| 248 | luaL_Reg uniquemetamethods[] = { |
| 249 | metamethods[0], |
| 250 | metamethods[1], |
| 251 | { nullptr, nullptr } |
| 252 | }; |
| 253 | luaL_newmetatable(L, "[unique]skr_opaque_t"); |
| 254 | luaL_register(L, nullptr, uniquemetamethods); |
| 255 | lua_pop(L, 1); |
| 256 | luaL_Reg sharedmetamethods[] = { |
| 257 | metamethods[0], |
| 258 | metamethods[1], |
| 259 | { nullptr, nullptr } |
| 260 | }; |
| 261 | luaL_newmetatable(L, "[shared]skr_opaque_t"); |
| 262 | luaL_register(L, nullptr, sharedmetamethods); |
| 263 | lua_pop(L, 1); |
| 264 | luaL_Reg objectmetamethods[] = { |
| 265 | metamethods[0], |
| 266 | metamethods[1], |
| 267 | { nullptr, nullptr } |
| 268 | }; |
| 269 | luaL_newmetatable(L, "[object]skr_opaque_t"); |
| 270 | luaL_register(L, nullptr, objectmetamethods); |
| 271 | lua_pop(L, 1); |
| 272 | } |
| 273 | |
| 274 | void skr_lua_close(lua_State* L) |
| 275 | { |
no test coverage detected