lua-users home
lua-l archive

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


Is there an equivalent of Perl's "AUTOLOAD" in Lua?  Autoload is a method that you implement that gets called when you call a method on an object but that method name has not been defined.  Somewhere in the online Lua book regarding metatables (I just ordered a hardcopy of the 2nd edition through Amazon) I recall reading that if you call a method that has not been named on an object in Lua, an error will be raised.  So if Lua does not have an equivalent of Perl's "AUTOLOAD", it would seem it could be emulated when trapping this error.

Feedback will be appreciated

George