[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: Sat, 12 Apr 2014 12:30:31 +0200
2014-04-12 12:15 GMT+02:00 duz <duz@sol-3.de>:
> On 12.04.2014 12:08, Dirk Laurie wrote:
>
>> Among the things I hit my head on were:
>>
>> 1. The notation z[x,y] does not translate to __index(z,x,y).
>
>
> And did you complain, why it doesn't?
> Were you satisfied with the answer?
I did not complain, but read the manual and PiL, and found the answer.
It was that __index should be a drop-in replacement for rawget.
So that, inter alia, the way in which it is used in the API remains valid.
---
int lua_gettable (lua_State *L, int index); [-1,+1,e]
Pushes onto the stack the value t[k], where t is the value at the given
index and k is the value at the top of the stack.
...
As in Lua, this function may trigger a metamethod for the "index"
event (see §2.4).
Returns the type of the pushed value.
---
I was satisfied with that answer.
- 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