diff options
| author | Alexander Gavrilov | 2012-08-22 18:18:19 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-08-22 18:18:19 +0400 |
| commit | 7987ea9a9877a4e9f44492210784c7e8d7f94bb9 (patch) | |
| tree | 768bd5aacaba64be23592b0a93f99ec8dd733b3d /library/LuaApi.cpp | |
| parent | 6e8b68fb29c52f1782938bf7aa564a516079bf61 (diff) | |
| download | dfhack-7987ea9a9877a4e9f44492210784c7e8d7f94bb9.tar.gz dfhack-7987ea9a9877a4e9f44492210784c7e8d7f94bb9.tar.bz2 dfhack-7987ea9a9877a4e9f44492210784c7e8d7f94bb9.tar.xz | |
Put some compatibility features into the base dfhack viewscreen.
Diffstat (limited to 'library/LuaApi.cpp')
| -rw-r--r-- | library/LuaApi.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 7f18ce3e..d25da808 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1179,7 +1179,14 @@ int screen_show(lua_State *L) before = Lua::CheckDFObject<df::viewscreen>(L, 2); df::viewscreen *screen = dfhack_lua_viewscreen::get_pointer(L, 1, true); - lua_pushboolean(L, Screen::show(screen, before)); + + bool ok = Screen::show(screen, before); + + // If it is a table, get_pointer created a new object. Don't leak it. + if (!ok && lua_istable(L, 1)) + delete screen; + + lua_pushboolean(L, ok); return 1; } |
