From 3e0280a3c44888483e1cea4ae6a177e35296b18d Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sat, 10 Apr 2021 17:19:05 +0300 Subject: [PATCH] Update sqratClassType.h --- module/Sqrat/sqratClassType.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/module/Sqrat/sqratClassType.h b/module/Sqrat/sqratClassType.h index e243ae39..673470e3 100644 --- a/module/Sqrat/sqratClassType.h +++ b/module/Sqrat/sqratClassType.h @@ -251,6 +251,20 @@ public: return 0; } + static void PushInstance(HSQUIRRELVM vm, C* ptr, std::nullptr_t) { + if (!ptr) { + sq_pushnull(vm); + return; + } + + ClassData* cd = getClassData(vm); + + typename std::unordered_map::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) { if (!ptr) { sq_pushnull(vm);