lua-users home
lua-l archive

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


On Tue, Oct 14, 2014 at 8:22 AM, Thiago L. <fakedme@gmail.com> wrote:
> On 14/10/14 10:18 AM, Javier Guerra Giraldez wrote:
>> On Tue, Oct 14, 2014 at 8:06 AM, Thiago L. <fakedme@gmail.com> wrote:
>>> the gain is that I don't have to expose rawset...
>>
>> but what if i don't want to set anything to this table?
>>
> then you don't return anything? (or return nil key?)

or set more than one value? or to a different table?  in the end you
need the equivalent of rawset()


unfortunately, it seems that this is a case of "all is well, don't
change anything".

Just guessing: this stems from the idea that __newindex is used mostly
to ultimately set a single value to the same table, and makes it the
default.  but if you remove the previous way to do it (rawset), you
have to provide all the capabilities.  in many cases by some contrived
and non-obvious constructions.

why not to expose rawset()?  is it for security reasons?  it might be
easier to provide a slightly patched version that only skips user's
__newindex but still respects those defined by your environment.

-- 
Javier