From 37f441d61b1e2f92a31fe8f71dc965254d8e0d95 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 22 Mar 2020 19:42:59 +0100 Subject: lua: restore recent end-file event, and deprecate it Lua changed behavior for this specific event. I considered the change minor enough that it would not need to go through deprecation, but someone hit it immediately and ask on the -dev channel. It's probably better to restore the behavior. But mark it as deprecated, since it's problematic (mismatch with the C API). Unfortunately, no automatic warning is possible. (Or maybe it is, by playing sophisticated Lua tricks such as setting a metatable and overriding indexing, but let's not.) --- player/lua/defaults.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'player/lua') diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua index 395ca87e03..32a6140be4 100644 --- a/player/lua/defaults.lua +++ b/player/lua/defaults.lua @@ -475,6 +475,15 @@ _G.print = mp.msg.info package.loaded["mp"] = mp package.loaded["mp.msg"] = mp.msg +function mp.wait_event(t) + local r = mp.raw_wait_event(t) + if r and r.file_error and not r.error then + -- compat; deprecated + r.error = r.file_error + end + return r +end + _G.mp_event_loop = function() mp.dispatch_events(true) end -- cgit v1.2.3