diff options
author | chai <chaifix@163.com> | 2021-10-18 23:20:28 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-18 23:20:28 +0800 |
commit | 45c05ac5610416e75a123995af649681d43adf7f (patch) | |
tree | a4373cc0589cd1d7f3c1d6c5ab75d9b41767c9b6 /Runtime/Lua/LuaBind/LuaBindState.h | |
parent | 83474a5ec3a25da9f66192f03f9b0628ad219404 (diff) |
* lua error handle
Diffstat (limited to 'Runtime/Lua/LuaBind/LuaBindState.h')
-rw-r--r-- | Runtime/Lua/LuaBind/LuaBindState.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Runtime/Lua/LuaBind/LuaBindState.h b/Runtime/Lua/LuaBind/LuaBindState.h index 776b23d..1f236df 100644 --- a/Runtime/Lua/LuaBind/LuaBindState.h +++ b/Runtime/Lua/LuaBind/LuaBindState.h @@ -15,6 +15,8 @@ namespace LuaBind class StrongRef; class WeakRef; + typedef void (*ErrorHandler) (cc8 * msg); + // 对lua_State的代理,除了保存一个lua_State的引用不保存其他内容。一个实例的metatable如下: // class table // member table @@ -60,7 +62,7 @@ namespace LuaBind int GetTop(); bool CheckParams(int idx, cc8* format); int AbsIndex(int idx); - void Call(int nArgs, int nResults); + void Call(int nArgs, int nResults, ErrorHandler handler = NULL); //------------------------------------------------------------------------------// @@ -137,7 +139,8 @@ namespace LuaBind //------------------------------------------------------------------------------// void DoString(const std::string& code); - void DoFile(const std::string& file); + void DoFile(const std::string& file, ErrorHandler handler = NULL); + void LoadFile(const std::string& file); //------------------------------------------------------------------------------// // 注册方法 @@ -187,7 +190,7 @@ namespace LuaBind }; //--------------------------------------------------------------------------------// - // GetValue()模板特化 +// GetValue()模板特化 template <> bool State::GetValue < bool >(int idx, const bool value); template <> cc8* State::GetValue < cc8* >(int idx, const cc8* value); |