Incorporated some suggestions, and some functions.

This commit is contained in:
Adam Harrison
2021-09-20 23:33:12 -04:00
parent fbc11c00eb
commit 3ca127793a
2 changed files with 8 additions and 11 deletions
+4 -11
View File
@@ -21,16 +21,9 @@ package.path = USERDIR .. '/?.lua;' .. package.path
package.path = USERDIR .. '/?/init.lua;' .. package.path
local dynamic_suffix = MACOS and 'lib' or (WINDOWS and 'dll' or 'so')
package.cpath = DATADIR .. '/?.' .. dynamic_suffix .. ';' .. package.cpath
package.cpath = USERDIR .. '/?.' .. dynamic_suffix .. ';' .. package.cpath
package.cpath = DATADIR .. '/?.' .. dynamic_suffix .. ";" .. USERDIR .. '/?.' .. dynamic_suffix
package.searchers[3] = function(modname)
local s,e = 0
repeat
e = package.cpath:find(";", s) or #package.cpath
local path = package.cpath:sub(s, e - 1):gsub("?", modname:gsub("%.", "/"))
if system.get_file_info(path) then
return system.load_native_plugin, path
end
s = e + 1
until s > #package.cpath
local path = package.searchpath(modname, package.cpath)
if not path then return nil end
return system.load_native_plugin, path
end