Sign in to follow this  
Followers 0
greeniekin

Detect if function argument is passed by reference

2 posts in this topic

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.

0

Share this post


Link to post
Share on other sites

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

1

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.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0