|
Hi,
This could be resolved with a non-local return mechanism for Lua that would let one build a function to do the following: local image, quality = return_if_nil( get_image_and_quality() )
I like this idea. I actually thought about it but it didn't seem to be possible without modifying Lua somehow. That's why I use exceptions. We could have two versions of this function, the return_if_nil would be for soft errors. Another version would throw an exception.Of course, we would still need it to run finalization code in either version. Hopefully we can come up with a method that will make sure all finalizers are called in case they are nested. I think it is possible to do it right now for the exception version, using another layer of pcall.
[]s, Diego.