diff options
Diffstat (limited to 'src/lua/common/je_lua_proxy.h')
-rw-r--r-- | src/lua/common/je_lua_proxy.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lua/common/je_lua_proxy.h b/src/lua/common/je_lua_proxy.h index 2914533..5541a5a 100644 --- a/src/lua/common/je_lua_proxy.h +++ b/src/lua/common/je_lua_proxy.h @@ -29,13 +29,7 @@ namespace JinEngine shared = nullptr; } } -/* - void retain() - { - if (shared != nullptr) - shared->retain(); - } -*/ + template<class T> Shared<T>& getShared() { @@ -62,9 +56,12 @@ namespace JinEngine }; - inline Proxy* luax_newinstance(lua_State* L, const char* type) + inline Proxy* luax_newinstance(lua_State* L, const char* type, SharedBase* shared = nullptr) { - return static_cast<Proxy*>(luax_newinstance(L, type, sizeof(Proxy))); + Proxy* proxy = static_cast<Proxy*>(luax_newinstance(L, type, sizeof(Proxy))); + if(shared) + proxy->bind(shared); + return proxy; } } // namespace Lua |