• Advertisement
Sign in to follow this  

Detect if function argument is passed by reference

This topic is 1650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement