From 6f20d6b74e247847dcfa36fdab0498f7280ab270 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 26 May 2014 21:46:01 +0200 Subject: 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. --- TOOLS/lua/autoload.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'TOOLS') 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 -- cgit v1.2.3