Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Detect if function argument is passed by reference


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 greeniekin   Members   -  Reputation: 139

Like
0Likes
Like

Posted 18 July 2013 - 07:05 PM

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.



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3221

Like
1Likes
Like

Posted 18 July 2013 - 07:59 PM

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

#3 greeniekin   Members   -  Reputation: 139

Like
0Likes
Like

Posted 18 July 2013 - 08:11 PM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS