History

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.)

wm4 committed 6 years ago

Commit 37f441d1 parent 3fedf614 files · +18 −6Browse files

Showing the changes to player/lua/defaults.lua (1 of 4 files). Show all

Unified · Split

player/lua/defaults.lua+9−0
@@ -475,6 +475,15 @@ _G.print = mp.msg.info · 474 unmodified lines
475475 package.loaded["mp"] = mp
476476 package.loaded["mp.msg"] = mp.msg
477477
478+function mp.wait_event(t)
479+ local r = mp.raw_wait_event(t)
480+ if r and r.file_error and not r.error then
481+ -- compat; deprecated
482+ r.error = r.file_error
483+ end
484+ return r
485+end
486+
478487 _G.mp_event_loop = function()
479488 mp.dispatch_events(true)
480489 end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t