lua-users home
lua-l archive

Re: :? syntactical sugar request

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


>> You could add an "index" tag method for this. Something like this:
>>
>> local NOP=function () end
>> settagmethod(tag(object),"index", function () return %NOP end)
>
>That works if you always want that behavior, but I'd like it to only 
>return the nop function in particular cases.
If those "particular cases" depend on the table or index, then you can write
 settagmethod(tag(object),"index", function (t,i) DO SOMETHING HERE end)
--lhf

AltStyle によって変換されたページ (->オリジナル) /