[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_findtable invoking metamethods
- From: Daurnimator <quae@...>
- Date: Fri, 22 Jul 2016 13:37:54 -0700
On 22 July 2016 at 06:19, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> I noticed today that luaL_findtable (as used by module() and
>> luaL_requiref) uses a mix of rawget and settable.
>> i.e. __index will not be fired, but __newindex will.
>
> I could not find where 'luaL_requiref' uses 'luaL_findtable'. This
> function is still in the code for compatibility only, so I don't
> think it is worth fixing a non-bug in it.
Ah sorry, I was incorrect about luaL_requiref.
I was didn't read the code correctly:
- luaL_findtable is called from luaL_pushmodule
- luaL_pushmodule is called from luaL_openlib
- I confused luaL_openlib for luaL_openlibs (note the 's')
- From which I saw luaL_requiref due to `ltests.h` (the lua test suite).
- At which point I jumped to a conclusion that luaL_requiref was
using luaL_findtable to create tables.... Which is entirely incorrect.
Sorry for the noise.