lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Sep 3, 2015 at 2:01 PM, Soni L. <fakedme@gmail.com> wrote:
> On 03/09/15 02:47 PM, Roberto Ierusalimschy wrote:
>>>
>>> The following function, when invoked, causes a C stack overflow
>>> in Lua 5.3.
>>>
>>> local subsystem_mt = {__index =
>>>     function(spec,auction)
>>>        for key,bid in ipairs(spec) do
>>>           print("Checking '"..auction.."' against '"..key.."'")
>>>        end
>>>     end}
>>
>> I may be missing something, but "The following function" does not seem
>> to be a function. It looks like a table... (Therefore, I do not know
>> how to invoke it to cause something.)
>>
>> -- Roberto
>>
> Well there is a function, it's inside the table...
>
> But I don't see how invoking it would cause something, either.
>
> subsystem_mt.__index()
> subsystem_mt:__index()
> subsystem_mt.__index(table)

Presumably by "when invoked", he means "when indexing a field with a
nil value in a table that uses subsystem_mt as its metatable". At
least that's how I understood it.