Re: __index returns truncated to one, why?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: __index returns truncated to one, why?
- From: Dirk Laurie <dirk.laurie@...>
- Date: 2014年4月12日 21:23:32 +0200
2014年04月12日 15:24 GMT+02:00 duz <duz@sol-3.de>:
> Your arguments against my little proposal are valid when
> looking at tables. I don't think much of them applies to
> the userdata case but likely, nobody would be thrilled if
> metamethods worked subtlety different on different objects.
In the userdata case, metamethods are merely a way of
mapping object methods to Lua syntax. Unfortunately,
"one key, one value" is part of Lua syntax.
var ::= Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name
Your proposal exposes a gap if not an ambiguity in the 5.3
manual. The __index metamethod is a function, it must behave
exactly as rawgetting a table would — but it requires deduction.
almost reading between the lines, to extract that information.
The 5.2 manual was clear on the topic, giving pseudocode
for gettable_event. Maybe something like that could be
brought back.
- References:
- __index returns truncated to one, why?, duz
- Re: __index returns truncated to one, why?, Peng Zhicheng
- Re: __index returns truncated to one, why?, Dirk Laurie
- Re: __index returns truncated to one, why?, duz
- Re: __index returns truncated to one, why?, Dirk Laurie
- Re: __index returns truncated to one, why?, duz
- Re: __index returns truncated to one, why?, Dirk Laurie
- Re: __index returns truncated to one, why?, duz