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.)
Showing the changes to player/lua/defaults.lua (1 of 4 files). Show all
Unified · Split
| @@ -475,6 +475,15 @@ _G.print = mp.msg.info · 474 unmodified lines | ||
| 475 | 475 | package.loaded["mp"] = mp |
| 476 | 476 | package.loaded["mp.msg"] = mp.msg |
| 477 | 477 | |
| 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 | + | |
| 478 | 487 | _G.mp_event_loop = function() |
| 479 | 488 | mp.dispatch_events(true) |
| 480 | 489 | end |