Skip to content

Commit 11abbec

Browse files
committed
Having idiomatic behavior for the imgui.safe functions.
1 parent ecc0fca commit 11abbec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/gui/imguisafe.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ function imgui.safe.builder(proxy, finalIfShown, final)
2525
args[#args] = nil
2626
local rets = { proxy(...) }
2727
local shown = rets[1]
28-
local status, err = pcall(function() lambda(table.unpack(args)) end)
29-
if shown and finalIfShown then finalIfShown() end
28+
local status, err = true
29+
if shown then
30+
status, err = pcall(function() lambda(table.unpack(args)) end)
31+
if finalIfShown then finalIfShown() end
32+
end
3033
if final then final() end
3134
if not status then error(err) end
3235
return table.unpack(rets)

0 commit comments

Comments
 (0)