ImageJ macro language inconsistent behavior when storing a string into an array

Dear ImageJ/FIJI team,

I just ran into some inconsistent/undocumented behavior while writing a short script using the ImageJ macro language. I tried to store a string directly returned from a function into an array, what prompted:
“Error: Numeric return value expected in line 23:”

The following code snippet demonstrates the error:

function getTestString() {
	return "test1";

string_values = newArray(100);
test_string = "test0";

// Works as advertised
string_values[0] = test_string;

// Function test

// Work around 
temp_string = getTestString();
string_values[1] = temp_string;

// String returned from function yields: "Error: Numeric return value expected in line 23:"
string_values[1] = getTestString();

I’m using FIJI current as of Nov 12 2020 (ImageJ 1.53c, Java 1.8.0_172) on a Win10 64-bit PC.

Best regards

1 Like

To solve this you need to:

string_values[1] = "" + getTestString();

Credit belongs to the old mailing list:

1 Like

Ah, the old mailing list didn’t show up in my search…
I just was curious about the behavior!
Many thanks and all the best.