Skip to content

Commit

Permalink
Adjust Lua paths
Browse files Browse the repository at this point in the history
Load lua modules from the plugin config directory. Closes #77
  • Loading branch information
dail8859 committed Jan 18, 2020
1 parent da3e85e commit 84092e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/SciTE/LuaExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,14 @@ static bool InitGlobalScope() {
// "onlyFuncs" is used to get only functions when a ':' is typed since it
// can only access functions
luaL_dostring(luaState, R"(
local function PackagePaths()
local md = npp:GetPluginsConfigDir() .. [[\LuaScriptLibs\]]
local cp = md.."?.dll;"..md.."?\\loadall.dll"
local lp = md.."lua\\?.lua;"..md.."lua\\?\\init.lua;"..md.."?.lua;"..md.."?\\init.lua"
return lp, cp
end
package.path, package.cpath = PackagePaths()
function GetAutoComplete(object, onlyFuncs)
local function GetKeys(tbl, list, onlyFuncs)
if type(tbl) == "table" then
Expand Down
11 changes: 3 additions & 8 deletions src/lua/src/luaconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,9 @@
** In Windows, any exclamation mark ('!') in the path is replaced by the
** path of the directory of the executable file of the current process.
*/
#define LUA_LSDIR "!\\plugins\\LuaScript\\"
#define LUA_CDIR LUA_LSDIR"lib\\"
#define LUA_LDIR LUA_CDIR"lua\\"
#define LUA_PATH_DEFAULT \
LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
#define LUA_CPATH_DEFAULT \
LUA_CDIR"?.dll;" LUA_CDIR"?\\loadall.dll"

#define LUA_PATH_DEFAULT ""
#define LUA_CPATH_DEFAULT ""

#else /* }{ */

Expand Down

0 comments on commit 84092e7

Please sign in to comment.