mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 08:08:47 -05:00
Make print() NUL-safe
This commit is contained in:
parent
c8a99404e8
commit
34d872628d
@ -47,11 +47,12 @@ int ModApiUtil::l_debug(lua_State *L)
|
|||||||
lua_pushvalue(L, -1); /* function to be called */
|
lua_pushvalue(L, -1); /* function to be called */
|
||||||
lua_pushvalue(L, i); /* value to print */
|
lua_pushvalue(L, i); /* value to print */
|
||||||
lua_call(L, 1, 1);
|
lua_call(L, 1, 1);
|
||||||
const char *s = lua_tostring(L, -1);
|
size_t len;
|
||||||
if (i>1)
|
const char *s = lua_tolstring(L, -1, &len);
|
||||||
|
if (i > 1)
|
||||||
dstream << "\t";
|
dstream << "\t";
|
||||||
if (s)
|
if (s)
|
||||||
dstream << s;
|
dstream << std::string(s, len);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
dstream << std::endl;
|
dstream << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user