aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-09-22 19:24:30 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-09-22 19:24:30 -0400
commit5bd1ca65de69a2ab8148fba4ec292953f31413c8 (patch)
treeb9b2ce0c9c712e168f20690614cf96adb7376a65
parente6b40a963768b9a900f5a8938718fe415a7a7b1a (diff)
Fixes to Lua paths.
Do not look in the current working directory for modules. Look in _USERHOME for shared libraries.
-rw-r--r--doc/11_Scripting.md1
-rw-r--r--init.lua2
2 files changed, 3 insertions, 0 deletions
diff --git a/doc/11_Scripting.md b/doc/11_Scripting.md
index 3c546f1a..abd4e313 100644
--- a/doc/11_Scripting.md
+++ b/doc/11_Scripting.md
@@ -44,6 +44,7 @@ as vanilla Lua with the following exceptions:
* `TA_LUA_PATH` and `TA_LUA_CPATH` are the environment variable used in place of
the usual `LUA_PATH` and `LUA_CPATH`.
* `LUA_ROOT` is `/usr/` in Linux systems instead of `/usr/local/`.
+* `LUA_PATH` and `LUA_CPATH` do not have `./?.lua` and `./?.so` in them.
* All compatibility flags for Lua 5.1 are turned off. (`LUA_COMPAT_UNPACK`,
`LUA_COMPAT_LOADERS`, `LUA_COMPAT_LOG10`, `LUA_COMPAT_LOADSTRING`,
`LUA_COMPAT_MAXN`, and `LUA_COMPAT_MODULE`.)
diff --git a/init.lua b/init.lua
index 7edee90a..60c157c4 100644
--- a/init.lua
+++ b/init.lua
@@ -6,6 +6,8 @@ package.path = table.concat({
_HOME..'/modules/?.lua', _HOME..'/modules/?/init.lua',
package.path
}, ';');
+local so = not WIN32 and '/?.so;' or '/?.dll;'
+package.cpath = _USERHOME..so.._USERHOME..'/modules'..so..package.cpath
local user_init, exists = _USERHOME..'/init.lua', lfs.attributes
local ok, err = pcall(dofile, user_init)