Advertisement

Dropping parameters when registering functions

Started by January 15, 2021 09:31 AM
1 comment, last by WitchLord 3 years, 10 months ago

Is this registration correct (nearestRef is dropped)?

// Vector3 CrowdManager::FindNearestPoint(const Vector3 &point, int queryFilterType, dtPolyRef *nearestRef=nullptr)

engine->RegisterObjectMethod("CrowdManager", "Vector3 FindNearestPoint(const Vector3&in, int)", asMETHOD(CrowdManager, FindNearestPoint), asCALL_THISCALL);

This registration has been working without problems for a long time, but I have doubts that this may cause some problems.

Or is the wrapper function required?

No, it's not correct.

AngelScript must know about all parameters it will send to the registered function, otherwise you might end up with garbage and unexpected results.

If the parameter cannot be exposed to the script then you'll need to use a wrapper.

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