Advertisement

Detect if function argument is passed by reference

Started by July 19, 2013 01:05 AM
1 comment, last by greeniekin 11 years, 4 months ago

I know this seems a bit silly but I made a helper class to load scripts and stuff.

I have been able to use the GetParamTypeId from asIScriptFunction to determine the type of parameters and what SetArg function to use. Though I do not know how you can detect if your using a reference like "int &out val" so that I can use SetArgAddress instead.

Any help is appreciated.

GetParamTypeId has an optional output parameter 'flags'. That is what you need to determine if the argument is by reference or not.

'flags' is a bitmask with a combination of the enums asTM_INREF, asTM_OUTREF, or asTM_INOUTREF. The last one is equal to asTM_INREF|asTM_OUTREF.

Regards,

Andreas

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

Thank you so much for the quick reply.

I did try the paramflags before but stupidly I was trying to do a bit mask with asOBJ_REF. It is working perfectly now.

This topic is closed to new replies.

Advertisement