Thanks WitchLord and Deyja for quick answering.
@WitchLord:
I spot about the in,out and inout for the reference passed as parameters as you explain to me.
So i tried:
r = mEngine->RegisterObjectMethod("Log", "logMessage(const string& in)",asFUNCTION(wrap_logMessage),asCALL_CDECL_OBJLAST); assert( r >= 0 );
but i get the same assert
I tried also:
r = mEngine->RegisterObjectMethod("Log","logMessage(const string& in,int e,bool b)",asMETHOD(Ogre::Log, logMessage),asCALL_THISCALL);assert( r >= 0 );... r = mEngine->ExecuteString(0,"log.logMessage(\"KooKoo from angels\",2,false)");
Assert again in registering the method.
This one works:
r = mEngine->RegisterObjectType("Log",sizeof(Ogre::Log),asOBJ_CLASS); r = mEngine->RegisterGlobalProperty("Log log",mLog);assert (r >= 0); r = mEngine->RegisterGlobalFunction("void logMessage(string &in,Log &in)",asFUNCTION(wrap_logMessage),asCALL_CDECL);assert( r >= 0 ); r = mEngine->ExecuteString(0,"logMessage(\"KooKoo from angels\",log)");
but as soon as i try to register it as a Class Method, it asserts.
@Deyja:
Do you mean i should register Log AND Log*,
like that:
r = mEngine->RegisterObjectType("Log",sizeof(Ogre::Log),asOBJ_CLASS);assert( r >= 0 );r = mEngine->RegisterObjectType("Log*",0,asOBJ_PRIMITIVE);assert( r >= 0 );... What should i register there ...r = mEngine->RegisterGlobalProperty("Log log",mLog);assert( r >= 0 );r = mEngine->ExecuteString(0,"log.logMessage(\"KooKoo from angels\")");
Could you explain that:
Quote:
Then you would bind a member function that accepts a log* and does the logging
I understand:
Quote:
a function doesn't have to actually be a member in C++ to be bound as a member in AS
as WitchLord Explain to me with the wrapper function registered as a member but i am hurt by:
Quote:
nor does an object in AS need to be the type it looks like
Do you mean as the scriptstring which can be used as std::string as the std:string buffer is the first Property in the class?
[Edited by - DaesDemon on August 19, 2005 8:56:20 AM]