lua-users home
lua-l archive

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


On Tue, Sep 6, 2011 at 01:10, startx <startx@plentyfact.org> wrote:
> On Tue, 6 Sep 2011 00:39:00 -0600
> HyperHacker <hyperhacker@gmail.com> wrote:
>
>> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
>> > f=io.open('foo.foo', 'r')
>> > f:write('ffd')
>> > f:close()
>> >
>>
>> Call me crazy, but I feel like f:write() should throw an error when
>> trying to write to a read-only file, instead of just doing nothing.
>>
>
> hm, when i do that ( on linux ) i _do_ get an error
>
>  lua: filer.lua:2: attempt to index global 'f' (a nil value)
>  stack traceback:
>          filer.lua:2: in main chunk
>          [C]: ?
>
> startx
>
>

You'd need to create a file "foo.foo" first...

-- 
Sent from my toaster.