summaryrefslogtreecommitdiff
path: root/src
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 /src
parent74ab7f976087c3f99735e602fff9c497e7223400 (diff)
✨ feat: 修改panic函数输出
Diffstat (limited to 'src')
-rw-r--r--src/tsg_lua_func.cpp5
1 files changed, 3 insertions, 2 deletions
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;