On Tue, Aug 6, 2013 at 12:25 PM, Emil Dotchevski <emildotchevski@xxxxxxxxx> wrote: > Hello, > > I need to modify Luajit to detect certain types of tables for which a C > callback is called with the value rather than the value being stored into > the table. In the original Lua, luaV_settable is given the value to store in > the table. In Luajit, lj_meta_tset isn't, instead it returns a TValue > pointer for the caller to copy the value into. > > I tried to add one more parameter to lj_meta_tset, to take in the value so > it can pass it to the C function if it needs to, and in that case return > &G(L)->tmptv so that the caller has a dummy place to copy the value into > (ideally it should indicate to the caller that it doesn't have to do > anything, but if I read the code correctly, returning NULL has different > semantics). > > Luajit builds successfully but I get a NULL pointer passed as the cTValue* > parameter I added to lj_meta_tset, which I'm reasonably sure is wrong. Is > this because the assembly that calls lj_meta_tset doesn't know about the > extra parameter I added? Is there a better way to achieve this? > > (Note again that this is a XBOX 360 project and JIT compilation is > disabled.) > > Thanks, > Emil Why can't you do this Lua-side by assigning a cfunction to __index/__newindex? /s/ Adam