[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: My program doesn't speak Portugese!
- From: Sean Conner <sean@...>
- Date: Thu, 25 Feb 2016 19:33:12 -0500
It was thus said that the Great David Given once stated:
> On 23/02/16 22:33, Luke Drummond wrote:
> [...]
> > `io.open` returns `errno` as its 3rd return value
>
> That is, unfortunately, not documented. Can I rely on it?
>
> There's also a more subtle problem --- errnos aren't very standardised.
> Luckily, the low-value ones are usually the same across platforms (I
> need to support Windows *and* Linux *and* BSD *and* OSX). ENOENT seems
> to be 2 on most. I found a handy table:
>
> http://www.ioplex.com/~miallen/errcmp.html
>
> Shame there isn't a portable way of converting an errno to an identifier
> string and back...
Um ... there is a module that does just that [1]. It's a C based module,
but it is available as a LuaRock, and I even gave an example of its use [2].
-spc (I'm just saying ... )
[1] https://github.com/spc476/lua-conmanorg/blob/errno-1.0.1/src/errno.c
[2] http://lua-users.org/lists/lua-l/2016-02/msg00230.html