lua-users home
lua-l archive

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


Then, whenever the C function associated with _proc_lua_assignment gets
called, it performs needed notifications in C then assigned the value to
the _hidden_vals sub table.  If the assignment operand is a LUA_TTABLE, it
set's up similar code for the new table.  My problem is that:

    root.sub1 = {}; root.sub1.foo = bar
or
    root.sub1 = { foo = bar }

Those works because you are actually assigning to root.

both work giving me proper notifications, however,

    root.sub1.foo = bar

That is not assigning anything to the root... that is obtaining the
'sub1' table from root, then assigning the 'foo' element to the value
'bar'.

One potential fix is to, in the __newindex call, attach a metatable to
each new table value of root... if you know that the assigned tables
will not have any metatable, then all is simple... otherwise you'll
have to be sure to properly chain.
--
Thomas Harning Jr.