[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Guessing the expected result type from an __index function
- From: Philipp Janda <siffiejoe@...>
- Date: Mon, 13 May 2013 12:35:54 +0200
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 ...