lua-users home
lua-l archive

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


Hello,

I do like the flexibility that you have using error function, you can pass a table with a lot of field to precise the nature of the error.

So you're able to do

error {
   code = my_code_number,
   message = "the number is invalid"
}

Unfortunately, it is not possible with assert, you *must* pass a string. I think it can be great to also have assert working like error so the following code become valid:

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

Of course, these are just examples and real life can have better ones.

Regards,
David.