Skip to content

Commit 84092e7

Browse files
committed
Adjust Lua paths
Load lua modules from the plugin config directory. Closes #77
1 parent da3e85e commit 84092e7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/SciTE/LuaExtension.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,14 @@ static bool InitGlobalScope() {
16261626
// "onlyFuncs" is used to get only functions when a ':' is typed since it
16271627
// can only access functions
16281628
luaL_dostring(luaState, R"(
1629+
local function PackagePaths()
1630+
local md = npp:GetPluginsConfigDir() .. [[\LuaScriptLibs\]]
1631+
local cp = md.."?.dll;"..md.."?\\loadall.dll"
1632+
local lp = md.."lua\\?.lua;"..md.."lua\\?\\init.lua;"..md.."?.lua;"..md.."?\\init.lua"
1633+
return lp, cp
1634+
end
1635+
package.path, package.cpath = PackagePaths()
1636+
16291637
function GetAutoComplete(object, onlyFuncs)
16301638
local function GetKeys(tbl, list, onlyFuncs)
16311639
if type(tbl) == "table" then

src/lua/src/luaconf.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,9 @@
185185
** In Windows, any exclamation mark ('!') in the path is replaced by the
186186
** path of the directory of the executable file of the current process.
187187
*/
188-
#define LUA_LSDIR "!\\plugins\\LuaScript\\"
189-
#define LUA_CDIR LUA_LSDIR"lib\\"
190-
#define LUA_LDIR LUA_CDIR"lua\\"
191-
#define LUA_PATH_DEFAULT \
192-
LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
193-
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
194-
#define LUA_CPATH_DEFAULT \
195-
LUA_CDIR"?.dll;" LUA_CDIR"?\\loadall.dll"
188+
189+
#define LUA_PATH_DEFAULT ""
190+
#define LUA_CPATH_DEFAULT ""
196191

197192
#else /* }{ */
198193

0 commit comments

Comments
 (0)