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/luax_state.h | |
parent | 3bced067a4144381e59ce4bd0eb749eeff5ad1f4 (diff) |
*thread
Diffstat (limited to 'source/3rd-party/Luax/luax_state.h')
-rw-r--r-- | source/3rd-party/Luax/luax_state.h | 71 |
1 files changed, 36 insertions, 35 deletions
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״̬ |