When Lua starts, it initialises package.path
and package.cpath
with values of LUA_PATH
and LUA_CPATH
environment variables. Setting up these environment variables will be one clean way to set paths. Appending LUA_PATH
's value with a double semi-colon will make Lua append the default path to the specified path.
Using bash on Linux, you can set the paths by adding these lines to the end of ~/.bashrc
file. For example:
## final ;; ensure that default path will be appended by Lua
export LUA_PATH="<path-to-add>;;"
export LUA_CPATH="./?.so;/usr/local/lib/lua/5.3/?.so;
/usr/local/share/lua/5.3/?.so;<path-to-add>"
Hope it helps.