lua-users home
lua-l archive

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



Le 02/07/2014 14:18, Victor Bombi a écrit :


local f = assert(io.open("my_secret_file", { code = 123, message = "database could not be opened" }))


assert(io.open("my_secret_file"))
works because in case of error io.open returns nil, err so you would like to change io.open also to return a predefined table?!



Yes, you're right, the io.open was a wrong example, I have other function which sometimes returns just false instead of the error message. e.g when there are no error message.

Cheers,
David.