|
On 11.04.2014 00:23, Andrew Starks wrote:
On Thursday, April 10, 2014, duz <duz@sol-3.de> wrote:local a, b, c = t[1]...No, it's meant to turn "return (h(table,index))" into "return h(table,index)"I'm sorry, but I still don't see why it is so important to throw away any values here. Why is __index it in 2.4 defined to return (h(table,index)) instead of just return h(table,index) which I'd find good uses for. Because a function has multiple return values and a single index of a table only has one value and that is a defined specification of the language. -Andrew
Searching the reference manual I find it defined in that one place Section 2.4, function gettable_event (table, key) I suggest to remove the parens around the return (h(...)) in the reference manual and stop dropping values returned from the handler. For symmetry, one could think of __newindex getting passed in any excess values from an assignment, such that t[1] = 7, 8, 9 calls the __newindex metamethod of t with three values. This would be a much greater change and I don't suggest it here as I don't oversee the consequences this would have.