lua-users home
lua-l archive

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


On Thu, Mar 31, 2011 at 11:41 AM,  <jose.camacho@ifm.com> wrote:
>> assert (loadfile ('.\\lib\\defs.lua'))
>> dofile ('test.lua')
> test.lua:1: module 'defs' not found:

This is one of those cases where package.path is needed - loadfile()
looks on a filesystem path, but the require() inside test.lua looks on
the Lua module path.

So if you had this line before the dofile():

package.path = [[lib\?.lua;]]..package.path

then things would work, because the _pattern_ lib\?.lua would match
with ? equal to 'def'.

steve d.