Re: require vs dofile (lua 5.1.4 windows)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: require vs dofile (lua 5.1.4 windows)
- From: Philippe Lhoste <PhiLho@...>
- Date: 2010年6月25日 10:07:03 +0200
Side note, as this is often missed by newcomers: instead of
require "..\\a\\a.lua"
will get a error can not find a.lua
but use
dofile("..\\a\\a.lua")
will ok
you can use either forward slashes as it is well supported by the Windows API:
require "../a/a.lua"
dofile "../a/a.lua"
and is more portable, or if you prefer to keep the Windows look (or just easier to
copy/paste these paths), just use long format of literal strings:
require [[..\a\a.lua]]
dofile [[..\a\a.lua]]
I always found these doubled anti-slashes quite ugly/unreadable. It is particularly
aggravating for regular expressions in Java (making stuff not particularly readable
totally obscure!) which doesn't have such facilities...
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --