[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: LuaPlus problem.
- From: "Ivano Coltellacci" <ivano.coltellacci@...>
- Date: Tue, 20 Jan 2004 23:42:42 +0100
Hi,
I have started to use your LuaPlus, too.
Im happy with it is a very nice work...I like the way I can manipulate
the lua_state.
Im interested for the new dispatcher too, because it does not need
to modify the lua interpreter.
Do you will integrate the new dispatcher into LuaPlus, too?
I understand from your code that you modify the lua interpreter
to have some extra feature like wstring, extra metatables,
memory management...
Do you plan, in a future work, to have these extra features up with
conditional compilation? This will be fun to use your Lua management
library with an unmodified Lua interpreter...
Thanks.
-----Message d'origine-----
De : lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]De la part de Joshua Jensen
Envoyé : mardi 20 janvier 2004 17:41
À : 'Lua list'
Objet : RE: LuaPlus problem.
> I have a problem using LuaPlus to call a C++ class member
> function with parameters from Lua Script.
>
> virtual void SomeOtherFunc( int i, float f, const
> char * psMessage )
> {
> //do stuff...
> }
>
> int main( int argc, char * argv[] )
> {
> LuaStateOwner poState;
> CMyClass oTestObject;
> LuaObject oLuaObject =
> oLuaGlobals.CreateTable( "LuaTestObject" );
>
> oLuaObject.RegisterEx( "SomeOtherFunc", oTestObject,
> CMyClass::SomeOtherFunc );
>
> poState->DoFile( "test.lua" );
> }
>
> In "test.lua" I have:
>
> LuaTestObject:SomeOtherFunc( 2, 3, "blah" )
The : operator in Lua passes an implicit 'self'... in this case,
LuaTestObject. It is syntactically equivalent to:
LuaTestObject.SomeOtherFunc( LuaTestObject, 2, 3, "blah" )
If your function is corrected to:
virtual void SomeOtherFunc( LuaObject o, int i, float f, const char *
psMessage )
Then the above will work.
But this still doesn't accomplish what you want based on this:
> It doesn't seem to matter what function parameters I try, none work.
> I need to attach the function to the Lua table, not in global
> scope, as I need to have multiple instances of the objects
> available to Lua.
I am releasing a standalone version of the internal LuaPlus Call Dispatcher
this evening. It does not require a modified Lua interpreter as past
versions have, so it should be accessible to all (but is more convenient
with the real LuaPlus). It also handles object dispatching, as you have
above.
I'll send it to you offline so you can peruse it before the release.
Josh
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.559 / Virus Database: 351 - Release Date: 1/7/2004