lua-users home
lua-l archive

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


On Thu, Jun 24, 2010 at 00:13, mos <[email protected]> wrote:
> Hi!
>    there are 2 files in 2 fold like:
> a
>  a.lua
> b
>  b.lua
>
> the b.lua use
>  require "..\\a\\a.lua"
> will get a error can not find a.lua
>
> but use
>  dofile("..\\a\\a.lua")
> will ok
>
> I don't konw why.
>
> Best Regard
> yujiang
>

require() looks in the paths in package.path and package.cpath, while
dofile() looks in the current working directory. See
http://www.lua.org/manual/5.1/manual.html#pdf-require

-- 
Sent from my toaster.