diff options
author | wm4 <wm4@nowhere> | 2014-05-26 21:46:01 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-05-26 21:59:29 +0200 |
commit | 6f20d6b74e247847dcfa36fdab0498f7280ab270 (patch) | |
tree | b72568437e86d8fae94ff16326b31a4551db3131 /TOOLS/lua | |
parent | 9c18a920ff0c5af3ed8868d38081e5ccb4d9ddc1 (diff) | |
download | mpv-6f20d6b74e247847dcfa36fdab0498f7280ab270.tar.bz2 mpv-6f20d6b74e247847dcfa36fdab0498f7280ab270.tar.xz |
lua: fix compilation with lua 5.2
Commit e2e450f9 started making use of luaL_register(), but OF COURSE
this function disappeared in Lua 5.2, and was replaced with a 5.2-only
alternative, slightly different mechanism.
So just NIH our own function. This is actually slightly more correct,
since it forces the user to call "require" to actually make the module
visible for builtin C-only modules other than "mp". Fix autoload.lua
accordingly.
Diffstat (limited to 'TOOLS/lua')
-rw-r--r-- | TOOLS/lua/autoload.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/TOOLS/lua/autoload.lua b/TOOLS/lua/autoload.lua index 1fe1aec49c..f6e9313f9a 100644 --- a/TOOLS/lua/autoload.lua +++ b/TOOLS/lua/autoload.lua @@ -7,6 +7,8 @@ -- Add at most 5 * 2 files when starting a file (before + after). MAXENTRIES = 5 +mputils = require 'mp.utils' + function add_files_at(index, files) index = index - 1 local oldcount = mp.get_property_number("playlist-count", 1) @@ -18,11 +20,11 @@ end function find_and_add_entries() local path = mp.get_property("path", "") - local dir, filename = mp.utils.split_path(path) + local dir, filename = mputils.split_path(path) if #dir == 0 then return end - local files = mp.utils.readdir(dir, "files") + local files = mputils.readdir(dir, "files") table.sort(files) local pl = mp.get_property_native("playlist", {}) local pl_current = mp.get_property_number("playlist-pos", 0) + 1 |