lua-users home
lua-l archive

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


Pierre Chapuis <catwell <at> archlinux.us> writes:

> 
> > Andre Arpin wrote:
> >> No the problem is that you have to change your lua_path to use
> >> require 'pl'
> >>
> >> This should be documented.
> >
> > The default path does include "?/init.lua", but unfortunately only in
> > the package installation directories (unless I missed something). See
> > luaconf.h:
> >
> >> #define LUA_ROOT	"/usr/local/"
> >> #define LUA_LDIR	LUA_ROOT "share/lua/" LUA_VDIR
> >> #define LUA_CDIR	LUA_ROOT "lib/lua/" LUA_VDIR
> >> #define LUA_PATH_DEFAULT  \
> >> 		LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
> >> 		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" "./?.lua"

You know this must have been added since I started working with Lua.

> 
> Wouldn't requiring "pl.init" instead of pl solve the problem
> in that case? Easier than changing lua_path...
> 

Yes, but it is not as cute.

I think luarock depends on this somedirectory/?/init.lua at other places. If 
you search this bulletin board (probably dating myself with this 
appellation)for init.lua a number of people had mixed problems because of 
it. Nice not to be alone.

I am wondering how many people depend on the default path?

Anyway I learn one more thing about the Lua implementation. I will reread 
the luaconf.h file and may learn even more.

By the way nowhere is the LUA_PATH_DEFAULT documented in Lua documentation. 
I guess reading the source is a good idea.

Andre