summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author“pengxuanzheng” <[email protected]>2022-06-01 10:22:23 +0000
committer“pengxuanzheng” <[email protected]>2022-06-01 10:22:23 +0000
commit60d7653f8a813f91c40a342d2ca4260002638986 (patch)
tree04150aa51fe60eca51bfb33713d0b69f88e63387
parent74ab7f976087c3f99735e602fff9c497e7223400 (diff)
✨ feat: 修改panic函数输出
-rw-r--r--include/tsg_lua_interface.h2
-rw-r--r--src/tsg_lua_func.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/include/tsg_lua_interface.h b/include/tsg_lua_interface.h
index ae12b73..20ca0c3 100644
--- a/include/tsg_lua_interface.h
+++ b/include/tsg_lua_interface.h
@@ -50,7 +50,7 @@ enum err_value
ERR_SCRIPT_ID_INVAILD = -33, /* 脚本ID无效 */
ERR_LUA_CACHE_FAILED = -34, /* 脚本缓存失败 */
ERR_MEM_NOT_ENOUGH = -35, /* 空间不足 */
- ERR_LUA_ID = -36, /* lua id 错误*/
+ ERR_LUA_ID = -36, /* lua id 错误*/
ERR_UNKNOWN = -37, /* 未知错误 */
};
diff --git a/src/tsg_lua_func.cpp b/src/tsg_lua_func.cpp
index feecae6..a24859b 100644
--- a/src/tsg_lua_func.cpp
+++ b/src/tsg_lua_func.cpp
@@ -423,7 +423,7 @@ static int c_lua_atpanic(lua_State *L)
if (s == NULL)
{
s = (char *)"unknow reason";
- len = sizeof(s);
+ len = strlen(s);
}
sprintf(err, "lua atpanic:lua VM creashed, reason:%*s\n", (int)len, s);
debuginfo(err, __FILE__, __LINE__);
@@ -925,6 +925,7 @@ int tsg_lua_cache_script(tsg_lua_handle lua, const char *script, size_t script_l
int i = 0;
int sharp = 0;
lua_State *L = (lua_State *)lua;
+ tsg_lua_clfactory_buffer_t ls;
if (L == NULL)
{
@@ -937,7 +938,7 @@ int tsg_lua_cache_script(tsg_lua_handle lua, const char *script, size_t script_l
return ERR_SCRIPT_ISNULL;
}
- tsg_lua_clfactory_buffer_t ls;
+ memset(&ls, 0, sizeof(tsg_lua_clfactory_buffer_t));
ls.s = script;
ls.size = script_len;
ls.sent_begin = 0;