Jump to content

[SOLVED] parse_expression problem in 310114 SDK (GAME)


photo

Recommended Posts

Hi

 

I have a problem with the latest version of Unigine. (310114 GAME)
This code worked fine in the previous version, and now reports an error.

 

 

simplified code is:

void main()
{
	int var1 = 6;
	int var2 = var1>10?var1:3*(var1-5);  //here is an error
	log.message("var1 %d var2 %d",var1,var2);
}

and reported error is:

Interpreter::parse_expression(): some errors with count of '(' and ')' symbols in "3*(var1-5" expression
Link to comment

Hi,

 

Ternary operator behavior was fixed in the latest SDK. Now you can write expressions in braces. Please, use following code to fix this issue:

int var2 = (var1 > 10) ? var1 : (3*(var1 - 5))

Also, please check updated documentation on ternary operator: https://developer.unigine.com/en/docs/1.0/scripting/language/operators#assignment

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...