Jump to content

[SOLVED] unable to use char or bool


photo

Recommended Posts

Thank You.

 

Actually I am planning to store some byte values. Because Unigine has no char or byte data type I am using string. I am adding byte by byte to string by as a character using

format("%s%c",dataString,byteValue);

 

But problem is it is not storing 0 value. Because 0 is null character it is not storing this value. Can any one suggest how can I store a 0 value into the string or any other solution to store set of bytes.

Link to comment

Thank you ulf,

 

I am using one C++ external plugin. In this one function is receiving a byte* (byte pointer) argument and one more function is returning byte* pointer. I unable to store it in an array of int. I don't want to change the external plugin code as it will be effected on other projects. Is there any other way to store byte values.

Link to comment

Then you possibly could wrap this in your own plugin (which uses the external one and exposes your functions to UNIGINE script)

 

Define a function that takes int array as argument and within the C++ code store these int values in a matching byte array and call the external C++ plugin function with the byte array.

 

Same approach for any char return value. Simply convert byte to int and return this int from your C++ plugin to UNIGINE script.

Link to comment

I unable get/set the data using int array.

 

I tried in three different ways to get data

 

1)

I declared an array in unigine script and sending this as argument to c++ plugin

Unigine Script

int data[100];

fun(data);

 

C++ code:

void fun(int data[]);

it is giving error : arrays can't be used in expressions

 

2)

returning int array from the c++ plugin and trying receive in script

Unigine Script

int data[] = fun();

 

C++ code:

int* fun();

 

it is also not working

 

3)

I also tried uisng external variable. I declared an global int array in c++ code and exported to use it in the script.

 

when I tried to read the data from the array in unigine script it is giving error: can't read int data from int.

 

Am I doing any mistake, please help me.

Link to comment
×
×
  • Create New...