lua-users home
lua-l archive

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


Hi everyone,

When writing: 

local data, err = f()

what is the error condition, data being nil, or err being not nil?

Is returning data AND a error frowned upon? Example: your f() is
instructed to return data in chunks of N bytes. But when the last chunk
is being read, the connection (socket, whatever) closes and f has less
than N bytes. An API that returns "incompletedata, 'closed'" is well
regarded?

Jorge