lua-users home
lua-l archive

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


On Wed, Sep 7, 2011 at 9:06 AM, Josh Simmons <simmons.44@gmail.com> wrote:
> On Wed, Sep 7, 2011 at 4:55 AM, Enrico Colombini <erix@erix.it> wrote:
>> On 06/09/2011 9.37, steve donovan wrote:
>>>
>>> Ah, but not always!
>>>
>>> f = io.open('errio.lua')
>>> for i = 1,3 do
>>>   print(f:read())
>>> end
>>> print(f:write('hello dolly'))
>>> f:close()
>>>
>>> On this machine (Windows XP) that write returns true - a silent error!
>>
>> That's strange: on my XP, Lua 5.1.2 prints:
>>
>>  1
>>  2
>>  3
>>  nil     No error        0
>>
>> Apart from the interesting "No error" error description, it seems to be as
>> expected.
>> errio.lua contains five lines.
>>
>> --
>>  Enrico
>>
>>
>
> The third number is the value of errno.
> nil, strerror(errno), errno
>
> Cheers,
> Josh.
>

The failure is not triggered be errno itself though, so it's possible
for any of the functions to return error but not set errno (on windows
anyway).