diff options
author | chai <chaifix@163.com> | 2019-03-12 23:08:31 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-12 23:08:31 +0800 |
commit | 6016ece202eef94ed76bd20d4f7879ccc71cc2e6 (patch) | |
tree | da0d0be011ee24489174bde1ec1c436ce7aaa1b2 /Source/3rdParty/Luax/luax_class.cpp | |
parent | 9eba034f5c2ffd49f33d38c283b24230f9e362e0 (diff) |
*luax
Diffstat (limited to 'Source/3rdParty/Luax/luax_class.cpp')
-rw-r--r-- | Source/3rdParty/Luax/luax_class.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/Source/3rdParty/Luax/luax_class.cpp b/Source/3rdParty/Luax/luax_class.cpp index 99da697..52cf6b7 100644 --- a/Source/3rdParty/Luax/luax_class.cpp +++ b/Source/3rdParty/Luax/luax_class.cpp @@ -1,27 +1,33 @@ #include "luax_state.h" #include "luax_class.h" +#include "luax_runtime.h" namespace Luax { LuaxClass::LuaxClass() - : mRefCount(1) // ʱĬһ + : mRC(1) // ʱĬһ + , mSafer(false) { } LuaxClass::~LuaxClass() { + assert(mSafer); } void LuaxClass::Retain() { - ++mRefCount; + ++mRC; } void LuaxClass::Release() { - if (--mRefCount <= 0) + if (--mRC <= 0) + { + mSafer = true; // safer delete this; + } } bool LuaxClass::PushLuaUserdata(LuaxState& state) @@ -29,9 +35,20 @@ namespace Luax return true; } - void LuaxClass::BindToLua(LuaxState& state) + void LuaxClass::BindFactoryToLua(LuaxState& state) + { + //assert(!mUserdata); + + // + state.PushPtrUserData(this); + + lua_newtable(state); // ref table + lua_newtable(state); // member table + + } + + void LuaxClass::BindSingletonToLua(LuaxState& state) { - assert(!mUserdata); } @@ -47,4 +64,9 @@ namespace Luax return 0; } + int LuaxClass::l_ToString(lua_State* L) + { + return 0; + } + }
\ No newline at end of file |