lua-users home
lua-l archive

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


On 26 February 2011 23:19, David Manura <dm.lua@math2.org> wrote:
> On Sat, Feb 26, 2011 at 5:54 PM, Reuben Thomas <rrt@sc3d.org> wrote:
>> [on package.config] What's wrong with a table?
>
> Also asked in [1].
>
> [1] http://lua-users.org/lists/lua-l/2010-06/msg00193.html

Indeed, and not answered.

I've just added the following interface to stdlib's io_ext module:

-- Reflect package.config (undocumented in 5.1; see luaconf.h for C
-- equivalents)
local _
_, _, dirsep, pathsep, path_mark, execdir, igmark =
  string.find (package.config,
"^([^\n]+)\n([^\n]+)\n([^\n]+)\n([^\n]+)\n([^\n]+)")

(note that strictly you can't just index the string: there's nothing
to guarantee that each "element" is a single character)

This means that I can now use

io.dirsep, io.pathsep, io.path_mark, io.execdir, io.igmark

Following the principle of least surprise, the names are just
lower-cased versions of the macros in luaconf.h.

Release in a few minutes!

-- 
http://rrt.sc3d.org