Jump to content

I'd like to get return value like a reference parameter of the C++ function.


photo

Recommended Posts

Posted

I'd like to get return value like a reference parameter of the C++ function.

 

Hi there.

I'd like to get values by the reference parameters like c++ function.

 

the sample is in below.

 

- Unigine script

 

void foo( float& ret )

{

ret = 1.0f;

}

 

- C++

 

Unigine::Variable var;

runWorld( "foo", var );

float ret = var.getFloat(); // ret is 0.

 

 

PS :

 

Is there any way to get reference values?

Posted

In C++ API it is not possible to get reference as the return value. But if you can get any variable on C++ side by calling (let's say it's a variable from the world script) pushWorld(), getWorld() and popWorld() after that. Similar functions are available for system and editor scripts.

×
×
  • Create New...