Frictional Games Forum (read-only)

Full Version: Pointers (parameter references)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
... Anyone know if we can use them? I read in the AngelScript manual that it supports C++ style Pointers in scripts but only if the application specifically allows it. Came across this as I was using a function to modify an array passed to the function thinking it would implicitly be passed by reference, which it doesn't seem to be (as the array in the calling function was not modified once the function had run), but before I explore possible other solutions it'd be great to know if it could simply be set as a pointer
I think the closest thing to what you are referring to is the use of the in and out keywords. By using out, you can have a function change the value of the variable passed in.
Indeed! The following is a working example, for anyone else that may be interested. This is the best way to get a function to return multiple values without using 'SetLocalVar...', if you find you need it. Thanks again for the help, YC

PHP Code:
void OnStart()
{
    
string strTest "Has not been changed";
    
Test_Var_Pointer(strTest);
    
AddDebugMessage(strTestfalse);
}

void Test_Var_Pointer(string &out strInput)
{
   
strInput "Changed!"