Skip to content

Commit

Permalink
日志不再使用tostring
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed May 22, 2019
1 parent 1f513f4 commit 264b1c3
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions Development/Plugin/Lua/log/luaopen_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,13 @@ static int llog_print(lua_State *L, logging::level lv) {

luaL_Buffer b;
luaL_buffinit(L, &b);
lua_getglobal(L, "tostring");
for (int i = 1; i <= n; i++) {
const char *s;
size_t l;
lua_pushvalue(L, n + 1);
lua_pushvalue(L, i);
lua_call(L, 1, 1);
s = lua_tolstring(L, -1, &l);
if (buffonstack(&b)) lua_insert(L, -2);
const char* s = lua_tolstring(L, i, &l);
if (s == NULL)
return luaL_error(L, "'tostring' must return a string to 'print'");
if (i>1) luaL_addchar(&b, '\t');
luaL_addlstring(&b, s, l);
lua_remove(L, n + 2);
}
luaL_pushresult(&b);
size_t l;
Expand Down

0 comments on commit 264b1c3

Please sign in to comment.