fix auxlib to use registerexit
This commit is contained in:
parent
856ca12c03
commit
1be04d3c5f
|
@ -14,13 +14,14 @@
|
||||||
-- callback function to clean up our mess
|
-- callback function to clean up our mess
|
||||||
-- this is called when the script exits (forced or natural)
|
-- this is called when the script exits (forced or natural)
|
||||||
-- you need to close all the open dialogs here or FCEUX crashes
|
-- you need to close all the open dialogs here or FCEUX crashes
|
||||||
function emu.OnClose.iuplua()
|
--function emu.OnClose.iuplua()
|
||||||
-- gui.popup("OnClose!");
|
-- gui.popup("OnClose!");
|
||||||
if(emu and emu.OnCloseIup ~= nil) then
|
--if(emu and emu.OnCloseIup ~= nil) then
|
||||||
emu.OnCloseIup();
|
-- emu.OnCloseIup();
|
||||||
end
|
--end
|
||||||
--iup.Close();
|
--iup.Close();
|
||||||
end
|
--end
|
||||||
|
|
||||||
|
|
||||||
-- this system allows you to open a number of dialogs without
|
-- this system allows you to open a number of dialogs without
|
||||||
-- having to bother about cleanup when the script exits
|
-- having to bother about cleanup when the script exits
|
||||||
|
@ -28,7 +29,7 @@ handles = {}; -- this table should hold the handle to all dialogs created in lua
|
||||||
dialogs = 0; -- should be incremented PRIOR to creating a new dialog
|
dialogs = 0; -- should be incremented PRIOR to creating a new dialog
|
||||||
|
|
||||||
-- called by the onclose event (above)
|
-- called by the onclose event (above)
|
||||||
function emu.OnCloseIup()
|
function OnCloseIup()
|
||||||
if (handles) then -- just in case the user was "smart" enough to clear this
|
if (handles) then -- just in case the user was "smart" enough to clear this
|
||||||
local i = 1;
|
local i = 1;
|
||||||
while (handles[i] ~= nil) do -- cycle through all handles, false handles are skipped, nil denotes the end
|
while (handles[i] ~= nil) do -- cycle through all handles, false handles are skipped, nil denotes the end
|
||||||
|
@ -40,3 +41,5 @@ function emu.OnCloseIup()
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
emu.registerexit(OnCloseIup);
|
||||||
|
|
Loading…
Reference in New Issue