lua-users home
lua-l archive

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

Am 13.05.2013 11:47 schröbte steve donovan:
As for the very useful distinction between method and field lookup, see

Similar drawback: you can't get the function value of a method. And if you allow this somehow, you basically just have two different namespaces for methods and properties, which will slow down lookup for one of those.

But I admit that providing properties *and* methods for a userdata feels a bit clumsy. I usually set an index metamethod with the method table as an upvalue, and check the method table first and then look for properties in the userdata. Maybe we could add an API function to lauxlib to help doing something like this ...