|
Thanks Udo and Andrew,
So to make things more specific, at this moment I have a struct containing the window handle. The light user data pointing to that struct has a metatable. I should override the __getindex method to be able to interpret: w._onMouseMove_ = function() ... end Now I 'm not sure: how/where should I store this function (or its reference?) so that I can call it later? And: how do I call it later once I know what light user data is to be "called"? (I assume the latter will be something like pushing the light user data on the stack, getting its metatable, pushing the name "onMouseMove", calling the "__index" function, ... well I think, but I don't really know how to do it) Can you give me some specific help on this? I have been able to create Lua objects in light user data's before but never have I had to do such interaction between C and Lua objects. Also, and possibly solved the same way as the above stuff: I would like the window object to contain a "userdata" table where the user can freely store specific data. So __index, called with "userdata" should return a lua_table. Again: where do I store this table to make sure it will always be the same table? Udo Schroeter schreef op 16/09/2014 10:56:
|