Closed benagricola closed 9 months ago
I confirmed and fixed in the 3.5-dev source code the bug with exists and indexing into testVector. Thanks for reporting this. I was unable to reproduce the bug with exists and indexing into the tools array. Log of test (read in reverse order):
15/02/2024, 09:57:08 echo {exists(tools[5])}
true
15/02/2024, 09:57:03 echo {exists(tools[4])}
false
15/02/2024, 09:55:45 echo exists(tools[4])
false
15/02/2024, 09:55:41 echo exists(tools[5])
true
15/02/2024, 09:55:33 m563 p5 s"test"
15/02/2024, 09:55:26 m563 p5 s"test" r0
Error: M563: unconfigured spindle
15/02/2024, 09:54:26 echo exists(tools[0])
true
15/02/2024, 09:54:00 echo exists(tools[49])
false
15/02/2024, 09:53:44 echo tools[49]
Error: line 10 column 6: meta command: array index out of bounds
15/02/2024, 09:53:37 echo tools[0]
{object}
Duet Forum Discussion Thread
https://forum.duet3d.com/topic/34967/function-exists-does-not-work-correctly-with-array-elements/2?_=1707983978816
Which Duet products are you using?
Firmware Version
3.5.0-rc.3+101
(STM32)Duet Web Control Version
3.5.0-rc.3
Are you using a Single Board Computer (RaspberryPi) with your Duet?
Please upload the results of sending M122 in the gcode console.
No response
Please upload the content of your config.g file.
No response
Please upload the content of any other releveant macro files.
Details specific to your printer.
N/A
Links to additional info.
No response
What happened?
Expected result Meta gcode function
exists()
could be called on an array index and identify whether the index exists in the array.Observed result Meta gcode function
exists()
simply returns the value of the item at the array index, if valid, or throws an index out of bounds error if not.Steps to reproduce