diff options
author | chai <chaifix@163.com> | 2019-03-29 00:43:25 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-29 00:43:25 +0800 |
commit | f4c338c63f3456a8eccd56c35e233843687d55be (patch) | |
tree | 7278fe4723320c9ef310c5a04d92bf0be1bc778c /source/3rd-party/Luax | |
parent | 3bced067a4144381e59ce4bd0eb749eeff5ad1f4 (diff) |
*thread
Diffstat (limited to 'source/3rd-party/Luax')
-rw-r--r-- | source/3rd-party/Luax/luax_class.hpp | 39 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_class.inl | 10 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_enum.cpp | 2 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_enum.h | 3 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_reftable.cpp | 10 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_runtime.cpp | 36 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_runtime.h | 15 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_state.cpp | 28 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_state.h | 71 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_vm.cpp (renamed from source/3rd-party/Luax/luax_context.cpp) | 10 | ||||
-rw-r--r-- | source/3rd-party/Luax/luax_vm.h (renamed from source/3rd-party/Luax/luax_context.h) | 10 |
11 files changed, 128 insertions, 106 deletions
diff --git a/source/3rd-party/Luax/luax_class.hpp b/source/3rd-party/Luax/luax_class.hpp index cfac2a5..99ac381 100644 --- a/source/3rd-party/Luax/luax_class.hpp +++ b/source/3rd-party/Luax/luax_class.hpp @@ -13,7 +13,8 @@ namespace Luax /// /// RegisterLuaxClass עķͳԱö١ȵclass table - /// LuaxGetFactoryName ùͬʱעʱעΪsingletonͨʱ + /// LuaxGetFactoryName ùͬʱעʱעΪsingletonͨ + /// ʱ /// #define LUAX_DECL_FACTORY(type) \ static void RegisterLuaxClass(Luax::LuaxState&);\ @@ -69,8 +70,9 @@ namespace Luax T* self = state.GetUserdata<T>(1); /// - /// ࣬Ϊʵֶ̬ҪЩӿڵⲿҪ̳д֮࣬оͻöӦʵķע̳д - /// ʱʵķʵLuaxNativeClassУʵֻᵼ¶ԡ + /// ࣬Ϊʵֶ̬ҪЩӿڵⲿҪ̳д֮࣬оͻ + /// öӦʵķע̳дʱʵķʵLuaxNativeClassУʵֻ + /// ¶ԡ /// class ILuaxNativeAccessor { @@ -88,7 +90,8 @@ namespace Luax }; /// - /// Ҫ¶luanative classҪ̳дࡣͨluaʵҪȷüȷԣڶ߳Ҫȷͷš + /// Ҫ¶luanative classҪ̳дࡣͨluaʵҪȷüȷԣ + /// ߳Ҫȷͷš /// template<class T> class LuaxNativeClass : public virtual ILuaxNativeAccessor @@ -98,8 +101,9 @@ namespace Luax static bool IsTypeOf(ILuaxNativeAccessor); /// - /// userdataΪkeyref tableuserdataһãάuserdataڡȽmember ref - /// ʵᱻαͬʵõƵЩʵ壬luaƵĵgc⡣ + /// userdataΪkeyref tableuserdataһãάuserdataڡ + /// Ƚmember refʵᱻαͬʵõƵЩʵ壬 + ///luaƵĵgc⡣ /// template<class U> void LuaxRetain(LuaxState& state, U* userdata); @@ -111,8 +115,8 @@ namespace Luax bool PushLuaxMemberRef(LuaxState& state, int refID) override; /// - /// userdata pushջûгʼmUserdataʼúԪѳʼõuserdataջһá - /// һnativeȨƽluaƵķ + /// userdata pushջûгʼmUserdataʼúԪѳʼõ + /// userdataջһáһnativeȨƽluaƵķ /// bool PushLuaxUserdata(LuaxState& state); bool PushLuaxMemberTable(LuaxState& state); @@ -143,8 +147,8 @@ namespace Luax static void PushLuaxClassTable(LuaxState& state); /// - /// ȡַҪַֻͨڶϴʵõջϺ;̬ıȡַ֤üȷ - /// ҪãʹôݶǴݵַ + /// ȡַҪַֻͨڶϴʵõջϺ;̬ı + /// ȡַ֤üȷҪãʹôݶǴݵַ /// void* operator &(); @@ -158,17 +162,18 @@ namespace Luax /// static LuaxStrongRef mClassTable; /// - /// ǵsingletonùϵԱ֤ᱻͨref tableijԱȫڵģ - /// ֱ_LUAX_STRONGREF_TABLEuserdataLuaxRetain\LuaxReleasemember refʱʵͬ - /// Ǵref tableģtable_LUAX_STRONGREF_TABLE + /// ǵsingletonùϵԱ֤ᱻͨref table + /// ijԱȫڵģֱ_LUAX_STRONGREF_TABLEuserdata + /// LuaxRetain\LuaxReleasemember refʱʵͬǴref table + /// ģtable_LUAX_STRONGREF_TABLE /// static LuaxStrongRef mSingletonRefTable; /// /// ͨuserdataõ: - /// 1: ref table - /// 2: member table - /// 3: class table + /// 1: ref table + /// 2: member table + /// 3: class table /// LuaxWeakRef mUserdata; @@ -193,7 +198,7 @@ namespace Luax #endif }; - //-------------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------// #if LUAX_ENABLE_PLAIN_CLASS /// diff --git a/source/3rd-party/Luax/luax_class.inl b/source/3rd-party/Luax/luax_class.inl index 7ee3de9..d1c8c4b 100644 --- a/source/3rd-party/Luax/luax_class.inl +++ b/source/3rd-party/Luax/luax_class.inl @@ -1,7 +1,7 @@ namespace Luax { - //---------------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------// // ӿ /// @@ -17,7 +17,7 @@ namespace Luax return 1; } - //---------------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------// /// /// עṤ͵еԱ @@ -205,8 +205,8 @@ namespace Luax assert(!T::IsLuaxClassSingleton()); assert(!mUserdata); - // userdataջ - state.PushPtrUserdata(this); + // userdataջעַҪתΪT*ֱthisܻᵼ¶ؼ̳еɥʧ̬ + state.PushPtrUserdata(static_cast<T*>(this)); lua_newtable(state); // ref tableluaʣC lua_newtable(state); // member tableluaдĶԱ @@ -315,7 +315,7 @@ namespace Luax } } - //-------------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------// /// /// ͷŹʵ diff --git a/source/3rd-party/Luax/luax_enum.cpp b/source/3rd-party/Luax/luax_enum.cpp index b054d98..60dd552 100644 --- a/source/3rd-party/Luax/luax_enum.cpp +++ b/source/3rd-party/Luax/luax_enum.cpp @@ -34,7 +34,7 @@ namespace Luax return luaL_error(L, "Enum called \"%s\" is readonly.", name); } - //-------------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------// #if LUAX_ENABLE_PLAIN_ENUM int LuaxPlainEnum::registry(lua_State* L) { diff --git a/source/3rd-party/Luax/luax_enum.h b/source/3rd-party/Luax/luax_enum.h index c385dc5..395eaf0 100644 --- a/source/3rd-party/Luax/luax_enum.h +++ b/source/3rd-party/Luax/luax_enum.h @@ -19,7 +19,8 @@ namespace Luax extern int l_rmt__newindex(lua_State* L); - //-------------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------// + #if LUAX_ENABLE_PLAIN_ENUM /// /// luaö٣ĵtable diff --git a/source/3rd-party/Luax/luax_reftable.cpp b/source/3rd-party/Luax/luax_reftable.cpp index 602c9eb..461e2d9 100644 --- a/source/3rd-party/Luax/luax_reftable.cpp +++ b/source/3rd-party/Luax/luax_reftable.cpp @@ -72,7 +72,7 @@ namespace Luax int LuaxRefTable::Ref(LuaxState& state, int idx) { - assert(mState && mState == state.GetHandle()); + assert(mState); idx = state.AbsIndex(idx); state.GetField(LUA_REGISTRYINDEX, mName); // ref table @@ -85,7 +85,7 @@ namespace Luax void LuaxRefTable::Unref(LuaxState& state, int refID) { - assert(mState && mState == state.GetHandle()); + assert(mState); state.GetField(LUA_REGISTRYINDEX, mName); // ref table luaL_unref(state, -1, refID); @@ -95,14 +95,14 @@ namespace Luax void LuaxRefTable::PushRefTable(LuaxState& state) { - assert(mState && mState == state.GetHandle()); + assert(mState); lua_getfield(state, LUA_REGISTRYINDEX, mName); } void LuaxRefTable::PushRef(LuaxState& state, int refID) { - assert(mState && mState == state.GetHandle()); + assert(mState); lua_getfield(state, LUA_REGISTRYINDEX, mName); lua_rawgeti(state, -1, refID); @@ -111,7 +111,7 @@ namespace Luax void LuaxRefTable::Clear(LuaxState& state) { - assert(mState && mState == state.GetHandle()); + assert(mState); lua_newtable(state); state.SetField(LUA_REGISTRYINDEX, mName); diff --git a/source/3rd-party/Luax/luax_runtime.cpp b/source/3rd-party/Luax/luax_runtime.cpp index b45d36a..dcf7b92 100644 --- a/source/3rd-party/Luax/luax_runtime.cpp +++ b/source/3rd-party/Luax/luax_runtime.cpp @@ -27,61 +27,69 @@ namespace Luax assert(L); // 1) - mContexts.insert(pair<lua_State*, LuaxContext>(L, LuaxContext(L))); + mContexts.insert(pair<lua_State*, LuaxVM*>(L, new LuaxVM(L))); // 2) ʼcontext (*this)[L].Setup(); return L; } - +/* + lua_State* LuaxRuntime::CreateThread(lua_State* main) + { + lua_State* thread = lua_newthread(main); + mContexts.insert(pair<lua_State*, LuaxVM*>(thread, mContexts[main])); + return thread; + } +*/ void LuaxRuntime::Close(lua_State* L) { - map<lua_State*, LuaxContext>::iterator it = mContexts.find(L); + map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); if (it != mContexts.end()) { - lua_close(it->second.state); + lua_close(it->second->state); mContexts.erase(it); } } bool LuaxRuntime::HasLuaxState(lua_State* L) { - map<lua_State*, LuaxContext>::iterator it = mContexts.find(L); + map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); return it != mContexts.end(); } LuaxState& LuaxRuntime::GetLuaxState(lua_State* L) { - map<lua_State*, LuaxContext>::iterator it = mContexts.find(L); + map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); if (it != mContexts.end()) { - return it->second.state; + return it->second->state; } } LuaxRefTable& LuaxRuntime::GetStrongRefTable(lua_State* L) { - map<lua_State*, LuaxContext>::iterator it = mContexts.find(L); + map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); if (it != mContexts.end()) { - return it->second.strongRefTable; + return it->second->strongRefTable; } } LuaxRefTable& LuaxRuntime::GetWeaksRefTable(lua_State* L) { - map<lua_State*, LuaxContext>::iterator it = mContexts.find(L); + map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); if (it != mContexts.end()) { - return it->second.weakRefTable; + return it->second->weakRefTable; } } - LuaxContext& LuaxRuntime::operator[](lua_State* L) + LuaxVM& LuaxRuntime::operator[](lua_State* L) { - map<lua_State*, LuaxContext>::iterator it = mContexts.find(L); + map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); assert(it != mContexts.end()); - return it->second; + + return *it->second; } } diff --git a/source/3rd-party/Luax/luax_runtime.h b/source/3rd-party/Luax/luax_runtime.h index 1234627..27c9af4 100644 --- a/source/3rd-party/Luax/luax_runtime.h +++ b/source/3rd-party/Luax/luax_runtime.h @@ -6,7 +6,7 @@ #include "luax_ref.h" #include "luax_config.h" #include "luax_state.h" -#include "luax_context.h" +#include "luax_vm.h" namespace Luax { @@ -21,10 +21,15 @@ namespace Luax static LuaxRuntime& Get(); /// - /// һµlua_Stateصlua_State*һ8\4ֽڵkey + /// һµluaʹ̲߳صlua_State*һ8\4ֽڵkey /// lua_State* Open(); - +/* + /// + /// ̴߳һ̡߳ӵcontextӳ䡣ҪΪ˷context߳ʡ + /// + lua_State* CreateThread(lua_State* mainThread); +*/ /// /// رlua_Stateruntimeɾ /// @@ -35,7 +40,7 @@ namespace Luax LuaxRefTable& GetStrongRefTable(lua_State* L); LuaxRefTable& GetWeaksRefTable(lua_State* L); - LuaxContext& operator[](lua_State* L); + LuaxVM& operator[](lua_State* L); private: @@ -47,7 +52,7 @@ namespace Luax /// /// lua_State handlecontextӳ /// - std::map<lua_State*, LuaxContext> mContexts; + std::map<lua_State*, LuaxVM*> mContexts; }; diff --git a/source/3rd-party/Luax/luax_state.cpp b/source/3rd-party/Luax/luax_state.cpp index b7b89a3..f453be7 100644 --- a/source/3rd-party/Luax/luax_state.cpp +++ b/source/3rd-party/Luax/luax_state.cpp @@ -741,7 +741,7 @@ namespace Luax } template <> - bool LuaxState::CheckParam < bool >(int idx) + bool LuaxState::CheckValue < bool >(int idx) { bool b = false; if (lua_type(mState, idx) == LUA_TBOOLEAN) @@ -756,73 +756,73 @@ namespace Luax } template <> - cc8* LuaxState::CheckParam < cc8* >(int idx) + cc8* LuaxState::CheckValue < cc8* >(int idx) { return luaL_checkstring(mState, idx); } template <> - double LuaxState::CheckParam < double >(int idx) + double LuaxState::CheckValue < double >(int idx) { return luaL_checknumber(mState, idx); } template <> - float LuaxState::CheckParam < float >(int idx) + float LuaxState::CheckValue < float >(int idx) { return luaL_checknumber(mState, idx); } template <> - s8 LuaxState::CheckParam < s8 >(int idx) + s8 LuaxState::CheckValue < s8 >(int idx) { return luaL_checkinteger(mState, idx); } template <> - s16 LuaxState::CheckParam < s16 >(int idx) + s16 LuaxState::CheckValue < s16 >(int idx) { return luaL_checkinteger(mState, idx); } template <> - s32 LuaxState::CheckParam < s32 >(int idx) + s32 LuaxState::CheckValue < s32 >(int idx) { return luaL_checkinteger(mState, idx); } template <> - s64 LuaxState::CheckParam < s64 >(int idx) + s64 LuaxState::CheckValue < s64 >(int idx) { return luaL_checkinteger(mState, idx); } template <> - u8 LuaxState::CheckParam < u8 >(int idx) + u8 LuaxState::CheckValue < u8 >(int idx) { return luaL_checkinteger(mState, idx); } template <> - u16 LuaxState::CheckParam < u16 >(int idx) + u16 LuaxState::CheckValue < u16 >(int idx) { return luaL_checkinteger(mState, idx); } template <> - u32 LuaxState::CheckParam < u32 >(int idx) + u32 LuaxState::CheckValue < u32 >(int idx) { return luaL_checkinteger(mState, idx); } template <> - u64 LuaxState::CheckParam < u64 >(int idx) + u64 LuaxState::CheckValue < u64 >(int idx) { return luaL_checkinteger(mState, idx); } template <> - std::string LuaxState::CheckParam < std::string >(int idx) + std::string LuaxState::CheckValue < std::string >(int idx) { return luaL_checkstring(mState, idx); } @@ -831,7 +831,7 @@ namespace Luax /// check light userdata /// template <> - const void* LuaxState::CheckParam < const void* >(int idx) + const void* LuaxState::CheckValue < const void* >(int idx) { if (IsType(idx, LUA_TLIGHTUSERDATA)) { diff --git a/source/3rd-party/Luax/luax_state.h b/source/3rd-party/Luax/luax_state.h index e9c394a..b6d1ff0 100644 --- a/source/3rd-party/Luax/luax_state.h +++ b/source/3rd-party/Luax/luax_state.h @@ -9,7 +9,7 @@ namespace Luax { - class LuaxContext; + class LuaxVM; class LuaxEnum; class LuaxStrongRef; class LuaxWeakRef; @@ -20,7 +20,8 @@ namespace Luax /// member table /// ref table /// userdata - /// userdataͨgetmetatableȡϼmetatable֮һclass tableעڶӦƿռ + /// userdataͨgetmetatableȡϼmetatable֮һclass tableעڶӦ + /// ƿռ /// LUAX_API class LuaxState { @@ -36,11 +37,11 @@ namespace Luax /// inline lua_State* GetHandle() { return mState; }; - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// void OpenLibs(); - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// // ƿռƿռһ_Gı void PushGlobalNamespace(); @@ -48,7 +49,7 @@ namespace Luax void PopNamespace(); bool IsNamespace(int idx); - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// void SetTop(int top); int GetTop(); @@ -56,7 +57,7 @@ namespace Luax int AbsIndex(int idx); void Call(int nArgs, int nResults); - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// void GetField(int idx, cc8* name); void GetField(int idx, int key); @@ -117,11 +118,11 @@ namespace Luax template<typename T> T* GetUserdata(int idx = 1); - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// int ErrorType(int idx, cc8* hint); - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// template<typename T> T GetValue(int idx, T default_value); template<typename T> T GetField(int idx, int key, T value); @@ -130,14 +131,14 @@ namespace Luax template<typename T> void SetFieldByIndex(int idx, int key, T value); template<typename T> T* CheckUserdata(int idx); - template<typename T> T CheckParam(int idx); + template<typename T> T CheckValue(int idx); - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// void DoString(const std::string& code); void DoFile(const std::string& file); - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// // ע᷽ /// @@ -166,9 +167,9 @@ namespace Luax void RegisterMethod(cc8* fname, lua_CFunction func); /// - /// preloaderӵpackage.preloadrequire"libname"ʱlualoader_preloadlibnameҵpreloaderֱӼء - /// ʵҪrequireʱżأҼعһκpackage.loaded¼´βټءͨrequire - /// preloader + /// preloaderӵpackage.preloadrequire"libname"ʱlualoader_preload + /// libnameҵpreloaderֱӼءʵҪrequireʱżأҼعһκ + /// package.loaded¼´βټءͨrequirepreloader /// void RegisterPreloader(cc8* libname, lua_CFunction preloader); @@ -191,11 +192,11 @@ namespace Luax void RegisterPlainEnumRegistry(cc8* name); #endif - //------------------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------// protected: - friend class LuaxContext; + friend class LuaxVM; LuaxState(lua_State* state); LuaxState(const LuaxState& state); @@ -211,7 +212,7 @@ namespace Luax }; - //-------------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------// // GetValue()ģػ template <> bool LuaxState::GetValue < bool >(int idx, const bool value); @@ -229,23 +230,23 @@ namespace Luax template <> std::string LuaxState::GetValue < std::string >(int idx, const std::string value); template <> const void* LuaxState::GetValue < const void* >(int idx, const void* value); - //-------------------------------------------------------------------------------------------------------------- - // CheckParamģػ - - template <> bool LuaxState::CheckParam < bool >(int idx); - template <> cc8* LuaxState::CheckParam < cc8* >(int idx); - template <> double LuaxState::CheckParam < double >(int idx); - template <> float LuaxState::CheckParam < float >(int idx); - template <> s8 LuaxState::CheckParam < s8 >(int idx); - template <> s16 LuaxState::CheckParam < s16 >(int idx); - template <> s32 LuaxState::CheckParam < s32 >(int idx); - template <> s64 LuaxState::CheckParam < s64 >(int idx); - template <> u8 LuaxState::CheckParam < u8 >(int idx); - template <> u16 LuaxState::CheckParam < u16 >(int idx); - template <> u32 LuaxState::CheckParam < u32 >(int idx); - template <> u64 LuaxState::CheckParam < u64 >(int idx); - template <> std::string LuaxState::CheckParam < std::string >(int idx); - template <> const void* LuaxState::CheckParam < const void* >(int idx); + //--------------------------------------------------------------------------------// + // CheckValueģػ + + template <> bool LuaxState::CheckValue < bool >(int idx); + template <> cc8* LuaxState::CheckValue < cc8* >(int idx); + template <> double LuaxState::CheckValue < double >(int idx); + template <> float LuaxState::CheckValue < float >(int idx); + template <> s8 LuaxState::CheckValue < s8 >(int idx); + template <> s16 LuaxState::CheckValue < s16 >(int idx); + template <> s32 LuaxState::CheckValue < s32 >(int idx); + template <> s64 LuaxState::CheckValue < s64 >(int idx); + template <> u8 LuaxState::CheckValue < u8 >(int idx); + template <> u16 LuaxState::CheckValue < u16 >(int idx); + template <> u32 LuaxState::CheckValue < u32 >(int idx); + template <> u64 LuaxState::CheckValue < u64 >(int idx); + template <> std::string LuaxState::CheckValue < std::string >(int idx); + template <> const void* LuaxState::CheckValue < const void* >(int idx); /// /// ڳԱﴴLuaxStateԲм顣 @@ -258,7 +259,7 @@ namespace Luax #define LUAX_STATE(L) \ Luax::LuaxState& state = Luax::LuaxRuntime::Get().GetLuaxState(L) - //-------------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------// /// /// ȷȫluaܹڵ֮صstack״̬ diff --git a/source/3rd-party/Luax/luax_context.cpp b/source/3rd-party/Luax/luax_vm.cpp index d41c24f..4257b4d 100644 --- a/source/3rd-party/Luax/luax_context.cpp +++ b/source/3rd-party/Luax/luax_vm.cpp @@ -1,25 +1,25 @@ -#include "luax_context.h" +#include "luax_vm.h" namespace Luax { - LuaxContext::LuaxContext(lua_State* L) + LuaxVM::LuaxVM(lua_State* L) : state(L) { assert(state); } - LuaxContext::~LuaxContext() + LuaxVM::~LuaxVM() { } // ʼcontext - void LuaxContext::Setup() + void LuaxVM::Setup() { SetupRefTables(); } - void LuaxContext::SetupRefTables() + void LuaxVM::SetupRefTables() { // strong ref weak ref strongRefTable.Init(state, "_LUAX_STRONGREF_TABLE"); diff --git a/source/3rd-party/Luax/luax_context.h b/source/3rd-party/Luax/luax_vm.h index 01c5937..e99d5b5 100644 --- a/source/3rd-party/Luax/luax_context.h +++ b/source/3rd-party/Luax/luax_vm.h @@ -11,15 +11,15 @@ namespace Luax /// /// lua_stateصcontextһϵдļϣҲûϵҪΪ˽Լڴ档 /// - class LuaxContext + class LuaxVM { public: - LuaxContext(lua_State* L); - ~LuaxContext(); + LuaxVM(lua_State* L); + ~LuaxVM(); void Setup(); - LuaxState state; // lua state + LuaxState state; // lua main state LuaxRefTable strongRefTable; // strong ref table LuaxRefTable weakRefTable; // weak ref table @@ -29,6 +29,8 @@ namespace Luax void SetupRefTables(); + int mThreadsCount; // context߳ + }; } |