lua-users home
lua-l archive

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


Edgar Toernig wrote:
Chris Marrin wrote:

[...] so here is the current proposed list:

errno()		return the last error string,number


errno is pointless.  Unlike C, Lua has multiple return values.
And I would suggest to use strings like "ENOTEMPTY" instead of
errno numbers.  The numbers are totally useless.

It's no more pointless than in C, where you can compare it against constants for useful results. But I agree that Lua does not have switch() or enums making it difficult to use integer return values. I will cobble together an initial (small) set of string return values. I am already returning multiple values (string,number) because that is what lposix did. The string is the strerror() string. Perhaps a better approach would be to return a string value for the error number along with a numeric version and add a separate strerror() function. This would allow lookup of error codes that do not come from these functions. If errno is a value for which I don't have a symbolic constant, I would return nil for the string and still return the number. That gives us fully general functionality.

How does that sound?



mkdir(path)		create a directory at the passed path


mkdir(path [, mode])

Sounds good. Done. But mode will have no effect on win32 because mkdir() on that platform does not take a mode param and I don't think win32 obeys the umask when creating directories. Anyone have info to the contrary?


Ciao, ET.


PS: I don't like the name osex.  I'd simply put them into os.

I don't think that's possible using the 5.1 package model. I suppose it is possible to make:

    require "osex"

add things to the 'os' table, assuming it exists. But that seems, at least, poor practice.

But I did just notice that this reads like "o-sex", so maybe "exos" would be better? :-)

--
chris marrin              ,""$, "As a general rule,don't solve puzzles
chris@marrin.com        b`    $  that open portals to Hell" ,,.
        ,.`           ,b`    ,`                            , 1$'
     ,|`             mP    ,`                              :$$'     ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`