[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __newindex rawsetless semantics?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 14 Oct 2014 10:03:03 -0300
> The idea is new semantics for __newindex so you can use it without rawset():
>
> function __newindex(t,k,v)
> if condition then
> return k,nv
> elseif othercondition then
> return nk,v
> elseif anothercondition then
> return nk,nv
> else
> return k,v
> end
> end
Would that be exactly equivalent to this?
function __newindex(t,k,v)
if condition then
rawset(t,k,nv)
elseif othercondition then
rawset(t,nk,v)
elseif anothercondition then
rawset(t,nk,nv)
else
rawset(t,k,v)
end
end
What is the gain?
-- Roberto