summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/defaults.lua15
-rw-r--r--player/lua/osc.lua2
2 files changed, 12 insertions, 5 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index 1ab1c4264a..8efa8d6315 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -135,7 +135,12 @@ mp.keep_running = true
local event_handlers = {}
function mp.register_event(name, cb)
- event_handlers[name] = cb
+ local list = event_handlers[name]
+ if not list then
+ list = {}
+ event_handlers[name] = list
+ end
+ list[#list + 1] = cb
return mp.request_event(name, true)
end
@@ -180,9 +185,11 @@ _G.mp_event_loop = function()
mp.suspend()
more_events = (e.event ~= "none")
if more_events then
- local handler = event_handlers[e.event]
- if handler then
- handler(e)
+ local handlers = event_handlers[e.event]
+ if handlers then
+ for _, handler in ipairs(handlers) do
+ handler(e)
+ end
end
end
end
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 5bf150274d..033f2c0d7e 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -121,7 +121,7 @@ function read_config(options, identifier)
local conffilename = "plugin_" .. identifier .. ".conf"
local conffile = mp.find_config_file(conffilename)
- local f = io.open(conffile,"r")
+ local f = conffile and io.open(conffile,"r")
if f == nil then
-- config not found
else