Advertisement

Global variable problem.

Started by October 22, 2008 08:55 PM
12 comments, last by WitchLord 16 years ago
here is the code;
nRet = (asERetCodes) pScriptEngine->RegisterObjectType("EventProcessStatus", sizeof(EventProcessStatus), asOBJ_VALUE | asOBJ_APP_CLASS_C);assert( nRet >= 0 );nRet = (asERetCodes) pScriptEngine->RegisterObjectBehaviour("EventProcessStatus", asBEHAVE_CONSTRUCT,    "void f()", asFUNCTION(clsDateDefaultConstructor), asCALL_CDECL_OBJLAST);assert( nRet >= 0 );nRet = (asERetCodes) pScriptEngine->ExecuteString(NULL, "EventProcessStatus a;", NULL);assert( nRet >= 0 );

It gives -17 on the last return value.
what's wrong with it?

Thanks


Quote: Original post by WitchLord
Hmm, I would have hoped that the example code in the manual would show otherwise.

http://www.angelcode.com/angelscript/sdk/docs/manual/doc_register_val_type.html

The idea is that the asOBJ_POD flag is valid together with asOBJ_VALUE, but not with asOBJ_REF. It doesn't say that it is not valid together with the asOBJ_APP_... flags.

I will however see if I can improve the documentation to clarify this a bit more. Thanks for the tip.


You either need to include the flag asOBJ_POD when registering the type, or register the asBEHAVE_DESTRUCT behaviour (even if the destructor doesn't do anything).

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
How can I modify the title of this question?
I believe it is more likely to be registration of the type question.
Just want to post a correct name for people who have the same question can lookup answer very simply.

:)

Quote: Original post by WitchLord
You either need to include the flag asOBJ_POD when registering the type, or register the asBEHAVE_DESTRUCT behaviour (even if the destructor doesn't do anything).


You should be able to change the title by editing your first post.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement