Jump to content

[SOLVED] Accessing array variable in world space


photo

Recommended Posts

Hi,

 

How do I access a container variable stored in engine.world from engine.system? I usually copy containers by passing an array argument and using argument.copy(array) but how do I do it across system/world/editor?

 

Eg:

 

// System level

namespace NetworkManager {

 

    // Need to access mVehicles data here..

    Vehicles tempArr[0];

    engine.world.call( "ExerciseManager::copyVehicles", tempArr );

}

 

// World level

namespace ExerciseManager {

 

    Vehicle mVehicles[0];

    

    void copyVehicles( arg[] )

    {

        arg.copy( mVehicles );

     }

}

 

The engine.world.call does not accept array and using 'callv' instead was throwing error saying 'copyVehicles with 0 arguments cannot be found' (also, I do not want to pass array in callv due to the size limit of 8). What is the correct way of doing this? Thanks.
Link to comment

Hey, Santosh!

 

It's not possible to share user classes between two different scripts even if that classes have similar names. Consider serializing that vehicle array to Stream class and passing it to engine.world.call function.

Link to comment

So is it possible to share int data array between script modules if not class array? By the way I managed without passing class data through engine.world.call() so its okay.

Link to comment
×
×
  • Create New...