1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Update sqratClassType.h

This commit is contained in:
Sandu Liviu Catalin 2021-04-10 17:19:05 +03:00
parent 33979d4c97
commit 3e0280a3c4

View File

@ -251,6 +251,20 @@ public:
return 0; return 0;
} }
static void PushInstance(HSQUIRRELVM vm, C* ptr, std::nullptr_t) {
if (!ptr) {
sq_pushnull(vm);
return;
}
ClassData<C>* cd = getClassData(vm);
typename std::unordered_map<C*, HSQOBJECT>::iterator it = cd->instances->find(ptr);
if (it != cd->instances->end()) {
sq_pushobject(vm, it->second);
} else sq_pushnull(vm);
}
static void PushInstance(HSQUIRRELVM vm, C* ptr) { static void PushInstance(HSQUIRRELVM vm, C* ptr) {
if (!ptr) { if (!ptr) {
sq_pushnull(vm); sq_pushnull(vm);