Original Post
Hey guys, I have this scenario: I want to enable my scripts to react to events, so I added a userdata data type to lua (EventHandler) EventHandler is basically a table that has the function RegisterEvent (a C-function) an exmample would be: eh = EventHandler.new() eh:RegisterEvent("GAME_STOP") function eh:OnEvent(event) -- do something end Now I wonder how to get the name of the table (or a refernce to it) so i can callback foo.OnEvent(event, ...) The callback basically looks like this: lua_getglobal(L, "foo"); lua_getfield(L, 1, "OnEvent"); lua_call(L, 1, 0); But I need to replace "foo" with something my C function for RegisterEvent gets when it is being called.