lua-users home
lua-l archive

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

using ToLua I can inherit a 'scripted class' from a native class (C++) 
and add functionality throught virtual functions. This works fine if 
the whole implementation is written in Lua, but for example I want to 
use my C++ coded event-queue, but be able to specify Lua-events. A 
event is defined something like:

class Event
		virtual void Execute() {}

Where the eventqueue will call the 'Execute' method for the events, 
from C++. Say I derive a LuaEvent using ToLua. Calling 
LuaEvent::Execute() from within Lua, would first call the scripted 
method, and then (optionally) the C++ function throught virtual 
inheritance, however, if I pass a pointer of the event to the event 
queue only the C++ Event::Execute() method would be called (of 

My question is, is there a simple way of automating a callback wrapper 
(C++->Lua) that can provide this functionality, or do I have to do it 
manually for every class?

-- Nils