pointer to pointer
i have a function to return pointer to an object.
wonder how to define it into angelscript.
engine.RegisterGlobalFunction("int scriptGetData(int, objectType&)", asFUNCTION(scriptGetData), asCALL_CDECL)
does it look meaningful ?
------------- C++ ---------------
int scriptGetData (int scriptNum, objectType **object)
{
if (scriptNum >= 0 && scriptNum < scriptObjectMax)
{
*object = &scriptObject[scriptNum];
if (scriptObject[scriptNum].script != NULL)
return (_SCRIPT_USED_);
}
scriptLog ("scriptGetData returned a NULL");
return (_SCRIPT_EMPTY_);
}
You'll have to register the function like so:
engine.RegisterGlobalFunction("int scriptGetData(int, objectType*&)", asFUNCTION(scriptGetData), asCALL_CDECL);
In the script you will then pass a pointer to an objecttype to the function.
engine.RegisterGlobalFunction("int scriptGetData(int, objectType*&)", asFUNCTION(scriptGetData), asCALL_CDECL);
In the script you will then pass a pointer to an objecttype to the function.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement