lua-users home
lua-l archive

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


On Wed, Jun 22, 2011 at 3:10 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> There seems to be another problem with the function approach (assuming
> an opaque structure). A subtle detail when creating files in Lua is
> that the creation of the userdata may fail (memory error). So, if the
> user opens a file and then calls this new function, Lua may raise an
> error and the open file is lost forever.

Then make this new function return NULL rather than throwing an error.