lua-users home
lua-l archive

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

Luiz Henrique de Figueiredo wrote:
If I say
and xxx.lua is not in the current directory, it is an error.

Is there a way of giving Lua a path in which dofile should look
before giving up?

Try require"xxx". Then Lua will search package.path for xxx.lua.

`require' takes exactly one argument (derived from a module name) and returns zero or one values. An arbitrary script on the other hand can take many arguments and return many values. Thus, `require' is not a substitution for running arbitrary scripts.

I personally am happy with a patch [1] to the Lua interpreter, that does exactly that: search for scripts on the so-called "LUA_RPATH".