Skip to content

Function bindable

Konstantin Tomashevich edited this page Jun 17, 2017 · 1 revision

Usage

Parses next function declaration. Example:

//@ASBindGen Function
float CalculateFarmsProductionAmount (District *district, GameConfiguration *configuration);

It reads CalculateFarmsProductionAmount function declaration. Functions can be parsed as free functions and as class methods. If Function command-comment found inside class declaration, it will be parsed as class method (if function is not static) or as free function (if function is static).

Binding arguments

OverrideName

Overrides function binding name. Example:

//@ASBindGen Function OverrideName=MySuperFunction
ReturnType MyFunction ();

OverrideType_arg${argIndex}

Overrides argument at argIndex type. Index -1 means return type. Example:

//@ASBindGen Function OverrideType_arg-1=NewReturnType OverrideType_arg0=NewArgType
ReturnType MyFunction (OldArgType arg);

OverrideName_arg${argIndex}

Overrides argument at argIndex name. Example:

//@ASBindGen Function OverrideName_arg0=newArgName
ReturnType MyFunction (ArgType oldArgName);

ReplaceInType_arg${argIndex}

Replaces in argument at argIndex type string before | by string after '|'. Index -1 means return type. Example:

//@ASBindGen Function ReplaceInType_arg-1=String|NewString ReplaceInType_arg0=&|
StringRet MyFunction (ArgType &arg);

ReplaceInName_arg${argIndex}

Replaces in argument at argIndex name string before | by string after '|'. Example:

//@ASBindGen Function ReplaceInType_arg0=XXX|YYY
ReturnType MyFunction (ArgType argXXX);

UseUrho3DScriptContext_arg${argIndex}

Pass pointer to Urho3D script context to this arg in wrapper. Example:

//@ASBindGen Function UseUrho3DScriptContext_arg0
Object *DoSomething (Urho3D::Context *context);

Note: this function will be accessable from script as DoSomething (), script context argument will be skipped in bindings.

AddRef_arg${argIndex}

Add ref to handle of argument at argIndex after function call. Index -1 means return type. Example:

//@ASBindGen Function AddRef_arg-1
Object *DoSomething ();

ReturnHandleArray

Use VectorToHandleArray converter in wrapper instead of VectorToArray. Useful if you return an array of pointers. Example:

//@ASBindGen Function ReturnHandleArray
Vector <Object *> DoSomething ();

AddNamespaceToName

Only for free functions!

Adds namespace to function accessor in generated wrapper. Useful in situations like this:

namespace DistrictUtils
{
//@ASBindGen Function AddNamespaceToCallName=DistrictUtils
float CalculateFarmsProductionAmount (District *district, GameConfiguration *configuration);
...
}