Lua: Guard against Lua returning non-string error
commitf537f4943c133aa86e721f3dca706fcad68577d5
authorIlari Liusvaara <ilariliusvaara@welho.com>
Sun, 5 Apr 2020 17:55:44 +0000 (5 20:55 +0300)
committerIlari Liusvaara <ilariliusvaara@welho.com>
Sun, 5 Apr 2020 17:55:44 +0000 (5 20:55 +0300)
treed83f80acfccc7153fe829e22831a5499eb496233
parent1b582c8fbdc49b9610735c7cab14bad61b13eb2f
Lua: Guard against Lua returning non-string error

Turns out that if Lua throws e.g. a table as error, tostring (and
tolstring) returns NULL. And trying to print NULL into message stream
causes it to hang). Guard against tolstring returning NULL, and print
(null) instead of trying to print the NULL pointer.
include/library/lua-base.hpp
src/lua/ibind.cpp
src/lua/lua.cpp
src/lua/memory.cpp