lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


If you want to add a new search directory for require you would do so for .lua files with package.path, with package.cpath for .so or .dll files (shared libraries that export a luaopen_*() function).

I frequently do this in a project if I'm requiring in a .lua from the same directory:

package.path = './.lua;' .. package.path

require 'local_file'

Look at package.path, it search those directories for the file you're require'ing in from left-to-right -- all the directories are between ; (; is the separator)

Remember: package.path for .lua -- package.cpath for .so/.dll


On Sat, Apr 5, 2014 at 1:11 PM, <tonyp@acm.org> wrote:
Correction:
app.lua starts with “require ‘app_lib’”