[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LOADPATH?
- From: Shmuel Zeigerman <shmuz@...>
- Date: Tue, 23 Nov 2010 20:01:03 +0200
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  to the Lua interpreter, that does
exactly that: search for scripts on the so-called "LUA_RPATH".