From 82956beb1fe17e1226327638c8ab22b5f5adfc1d Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 20 Mar 2019 22:43:25 +0800 Subject: *misc --- source/3rd-party/Luax/luax_state.h | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'source/3rd-party/Luax/luax_state.h') diff --git a/source/3rd-party/Luax/luax_state.h b/source/3rd-party/Luax/luax_state.h index fbe424b..564eba3 100644 --- a/source/3rd-party/Luax/luax_state.h +++ b/source/3rd-party/Luax/luax_state.h @@ -107,13 +107,17 @@ namespace Luax /// /// 以void** 的形式创建userdata,并将值设置为ptr /// - void PushPtrUserData(void* ptr); + void PushPtrUserdata(void* ptr); void Pop(int n = 1); void Settop(int idx); - template T* GetLuaUserdata(int idx = 1); + template T* GetUserdata(int idx = 1); + + //------------------------------------------------------------------------------------------------------------ + + int ErrorType(int idx, cc8* hint); //------------------------------------------------------------------------------------------------------------ @@ -123,6 +127,9 @@ namespace Luax template void SetField(int idx, cc8* key, T value); template void SetFieldByIndex(int idx, int key, T value); + template T* CheckUserdata(int idx); + template T CheckParam(int idx); + //------------------------------------------------------------------------------------------------------------ void DoString(const std::string& code); @@ -175,7 +182,7 @@ namespace Luax void RegisterPlainClassRegistry(cc8* name); #endif -#if LUAX_ENABLE_PLAIN_ENABLE +#if LUAX_ENABLE_PLAIN_ENUM /// /// 注册纯lua的枚举,以防止修改枚举值。 /// @@ -203,7 +210,7 @@ namespace Luax }; //-------------------------------------------------------------------------------------------------------------- - // GetValue()模板特化 + // GetValue()模板实例化 template <> bool LuaxState::GetValue < bool >(int idx, const bool value); template <> cc8* LuaxState::GetValue < cc8* >(int idx, const cc8* value); @@ -219,8 +226,24 @@ namespace Luax template <> u64 LuaxState::GetValue < u64 >(int idx, const u64 value); 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); - template <> int LuaxState::GetValue < int >(int idx, int 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); /// /// 在成员方法里创建LuaxState并对参数进行检查。 -- cgit v1.1-26-g67d0