diff options
author | wm4 <wm4@nowhere> | 2014-07-07 17:13:44 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-07-07 18:00:41 +0200 |
commit | 02ca42c7f17cb03b79a4ce7625d669361b45fc94 (patch) | |
tree | 8eb70902fdf08009396e80796a176ed4f861534f /common/encode_lavc.h | |
parent | 0ea2bc2778b6b41e5e4360dbc74b9e00119b40ba (diff) | |
download | mpv-02ca42c7f17cb03b79a4ce7625d669361b45fc94.tar.bz2 mpv-02ca42c7f17cb03b79a4ce7625d669361b45fc94.tar.xz |
lua: redo error handling, print backtraces
The original goal was just adding backtraces, however making the code
safe (especially wrt. to out of memory Lua errors) was hard. So this
commit also restructures error handling to make it conceptually simpler.
Now all Lua code is run inside a Lua error handling, except the calls
for creating and destroying the Lua context, and calling the wrapper C
function in a safe way.
The new error handling is actually conceptually simpler and more
correct, because you can just call any Lua function at initialization,
without having to worry whwther it throws errors or not.
Unfortunately, Lua 5.2 removes lua_cpcall(), so we have to emulate it.
There isn't any way to emulate it in a way that works the same on 5.1
and 5.2 with the same semantics in error cases, so ifdeffery is needed.
The debug.traceback() function also behaves weirdly differently between
the Lua versions, so its output is not as nice as it could be (empty
extra line).
Diffstat (limited to 'common/encode_lavc.h')
0 files changed, 0 insertions, 0 deletions