|
Luiz Henrique de Figueiredo wrote:
If I say dofile('xxx.lua') 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".
[1] http://lua-users.org/lists/lua-l/2006-01/msg00130.html -- Shmuel