lua-users home
lua-l archive

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


> Still, even in 5.1, how does one find out about the physical location
> of a package?
Not too sure what you want, start with an investigation of the "package" table.

  for k,v in package do print (k,v) end

cpath and path may be what you are after although I suspect not.

When you use "require" the package.path defines where the source
will be loaded from. Which part of the package.path is not recorded.

> As an aside, how does one find out the OS file separator (e.g. '/')
> from Lua itself?
>

You cant. (Someone tell me if I am wrong). In 5.1 there nothing Lua does that
needs it ither than the C defined LUA_DIRSEP which is not aptly named.
It will probably be defined as "" for me. You could deduce it from package.path 
and package.cpath or externally define PATH_SEP so you could use
os.getenv'PATH_SEP'