Array variable results in " Error: meta command: expected '}' "
-
Using array variables in RRF 3.5.0-beta.4, I am attempting to create large arrays that will be used for later macros; however, I have encountered an issue where arrays of a certain length result in an error saying " Error: meta command expected: '}' "
To illustrate the issue, the following code creates two arrays. The first array is created without a problem. The second array, identical to the first but with one additional element, cannot be created and results in the error described above.
;ArrayProblem.g
var array1 = {108,106,91,100,110,76,74,63,46,28}
echo {var.array1}
var array2 = {108,106,91,100,110,76,74,63,46,28,33}
echo{var.array2}Console Output:
M98 P"0:/sys/ArrayProblem.g"
{108,106,91,100,110,76,74,63,46,28,}
Error: in file macro line 4 column 48: meta command: expected '}'For information about the system I am operating, here is the output of running M115 from the console:
M115
FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 3.5.0-beta.4 ELECTRONICS: Duet WiFi 1.02 or later + DueX5v0.11 FIRMWARE_DATE: 2023-06-08 23:39:39 -
@jcioni said in Array variable results in " Error: meta command: expected '}' ":
var array2 = {108,106,91,100,110,76,74,63,46,28,33}
I can confirm i get the same result on mini5+ with 3.5 beta4.
This may be a limit on the number of elements in an array of 10 in the current 3.5beta4 firmware build. @dc42 can confirm that but it looks likely given that
var array2 = {{108,106},91,100,110,76,74,63,46,28,33}
works, which creates a 10 element array with the first element being an array of two values.We don't appear to document the maximum number of elements in an array so we will need to address that.
-
@jcioni Thanks for reporting this. There is currently a limit of 10 array elements when creating a literal array. I have just increased this limit to 40 in the source code, and added a separate message if you try to exceed it.