[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require vs dofile (lua 5.1.4 windows)
- From: HyperHacker <hyperhacker@...>
- Date: Thu, 24 Jun 2010 00:21:33 -0600
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.