Search code examples
luatorch

What is PYTHONPATH counterpart for Lua?


I like to make some of my own classes available system-wide in Torch7. In python it is enough to give the class files paths to PYTHONPATH environment variable. Is there any equal way to do this for Lua?


Solution

  • The environmental variable you are looking for is LUA_PATH

    At start-up, Lua initializes this [package.path] variable with the value of the environment variable LUA_PATH_5_3 or the environment variable LUA_PATH or with a default path defined in luaconf.h, if those environment variables are not defined. Any ";;" in the value of the environment variable is replaced by the default path.

    For example, to have Lua look for files in /home/bob/lualibs, you would set LUA_PATH to /home/bob/lualibs;;