🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

pointer to pointer

Started by
0 comments, last by WitchLord 19 years, 6 months ago
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_); }
Advertisement
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.

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