summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/console/init.lua
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-04-07 06:20:40 +1000
committer Vas Crabb <vas@vastheman.com>2023-04-07 06:20:40 +1000
commitb67b969bf0911d71396c77e42d85ddfe80de6f20 (patch)
tree8d964eac6e0c4c849dc2b9b0b3742154c6c943d4 /plugins/console/init.lua
parentc4282fecede9032be78028e8fde737d44bf2b7c6 (diff)
-Improved some Lua APIs:
* Moved several machine lifecycle callbacks to the notifier/subscriber model. The old callback registration model is still available for them for now, but prints a deprecation warning. * Added pre-save/post-load notifications. * Use a single allocated timer rather than one anonymous timer per waiter. Waiters no longer prevent saved states from being loaded. * Clean up outstanding waiters on stop or state load rather than just leaking them. * Started documenting parts of the emulator interface object that should be relatively stable. -imagedev/avivideo.cpp: Fixed an object leak on unload. Also changed some other media image devices to use smart pointers.
Diffstat (limited to 'plugins/console/init.lua')
-rw-r--r--plugins/console/init.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/console/init.lua b/plugins/console/init.lua
index 7c04184513d..a9835ae4ad4 100644
--- a/plugins/console/init.lua
+++ b/plugins/console/init.lua
@@ -13,6 +13,8 @@ local history_file = "console_history"
local history_fullpath = nil
+local reset_subscription, stop_subscription
+
function console.startplugin()
local conth = emu.thread()
local ln_started = false
@@ -220,16 +222,18 @@ function console.startplugin()
return table.concat(result, '\001')
end
- emu.register_start(function()
+ reset_subscription = emu.add_machine_reset_notifier(function ()
if not consolebuf and manager.machine.debugger then
consolebuf = manager.machine.debugger.consolelog
lastindex = 0
end
end)
- emu.register_stop(function() consolebuf = nil end)
+ stop_subscription = emu.add_machine_stop_notifier(function ()
+ consolebuf = nil
+ end)
- emu.register_periodic(function()
+ emu.register_periodic(function ()
if stopped then
return
end