-
Notifications
You must be signed in to change notification settings - Fork 449
Lua's onconsoleclose is broken #4685
Copy link
Copy link
Closed as not planned
Labels
Tool: Lua ConsoleRelating to the Lua Console (not EmuHawk's Lua API)Relating to the Lua Console (not EmuHawk's Lua API)Working as intended (wontfix)Bug in deprecated feature, or misidentification of correct behavior, or unreasonable feature requestBug in deprecated feature, or misidentification of correct behavior, or unreasonable feature requestre: Lua API/scriptingRelating to EmuHawk's Lua API (not the Lua Console)Relating to EmuHawk's Lua API (not the Lua Console)
Metadata
Metadata
Assignees
Labels
Tool: Lua ConsoleRelating to the Lua Console (not EmuHawk's Lua API)Relating to the Lua Console (not EmuHawk's Lua API)Working as intended (wontfix)Bug in deprecated feature, or misidentification of correct behavior, or unreasonable feature requestBug in deprecated feature, or misidentification of correct behavior, or unreasonable feature requestre: Lua API/scriptingRelating to EmuHawk's Lua API (not the Lua Console)Relating to EmuHawk's Lua API (not the Lua Console)
The Lua event
onconsoleclosedoes not work, and the only way to trigger it does not involve closing the emulator. The code calling it is inLuaLibraries.Close, but all scripts are stopped (and their callbacks cleared) before this method runs. Lua scripts will not be stopped if the core reboot is due toclient.reboot_core, but thenLuaLibraries.Closealso is not called so the Lua event still is not triggered.Repro
Run this script, and observe it does not print when rebooting the core or closing the ROM:
The only way to trigger it is to close the Lua Console tool, which is a situation where it should not trigger. If you replace the
printwith something likeclient.togglepause()you can observe the event being triggered when you close the tool. The name "on console close" actually makes some sense for something that runs when the Lua Console tool closes, since the tool has "console" in it's name; but the Lua function's description says "Fires when the emulator console closes" so it refers to the emulator core, not the Lua Console.I discovered this issue while looking for a workaround for #4629, trying to find a way to detect core reboots in a Lua script exit handler. (I did not find one.)
Output
No error message.
Host env.
Current master, 2.11, and 2.9.1 all have this issue and are the only versions I've tested.