[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tolua++ exported utility functions missing?
- From: Waldemar Celes <celes@...>
- Date: Wed, 23 Jun 2004 17:47:07 -0300
In general, I use the following strategy to do that.
Create a C++ class, inheriting from the base class you want to extend in Lua.
The constructor of this new class expects a Lua table as an input parameter.
All virtual methods are implemented calling the appropriate Lua method
stored in that table,
push the parameters and popping the results. You then export this derived
class to Lua.
In Lua, you will be able to write:
local myClass = {
method1 = function (self, ...)
end,
method2 = function (self, ...)
end,
}
local myInstance = Derived_Class:new(myClass)
hope it helps.
-- waldemar
At 13:13 23/6/2004 -0700, you wrote:
OK, that's fine.
Then I have a related question: is it possible to
export a C++ class to lua, and then derive from it in
lua? If so, it is not discussed in the documentation.
db