lua-users home
lua-l archive

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


it cannot be a table with a call method. 

This, in practice, is fine. If I need to bring "self" or a context object along, I can use upvalues.

As it turns out, I'm just Traning the results of pcall, handling the error if it's something that I'm looking for, and then pass that along if all is good or handle the interesting issues, and then error. 

My point is that I explored using an error handler object where the execution function was the call method and there was one handler for the entire "class". But I couldn't see how I could do that without creating a unique msgh object for every instance of *my* object, so I "gave up" and I trap the error with pcall, storing any context that I need in within the object, itself.

This might be the best design, overall. There may have been another way to do it. I believe that there is a possibility that changing xpcall, so that it respects a table's __call method, might be worth a look. 

-Andrew