It is not possible to change the size of arrays in KUKA KRL, nor is it possible to dynamically set the size of an array, such as with a variable in the declaration like:
DECL INT test_array[i]
Arrays must be pre-allocated. If you aren't sure how many elements you need to store, then its best to pre-allocate the array with a large number that you feel certain won't overflow.
You cannot use list like behavior with arrays, so no Add or Find, etc. Its bare bones assignments to explicit indices.
You can also make an array of STRUCs, which are as close to an object as you get in KRL. STRUCs in KRL work similarly to structures in other programming languages.
It is not possible to change the size of arrays in KUKA KRL, nor is it possible to dynamically set the size of an array, such as with a variable in the declaration like:
Arrays must be pre-allocated. If you aren't sure how many elements you need to store, then its best to pre-allocate the array with a large number that you feel certain won't overflow.
You cannot use list like behavior with arrays, so no Add or Find, etc. Its bare bones assignments to explicit indices.
You CAN do multi-dimension arrays, such as this:
You can also make an array of STRUCs, which are as close to an object as you get in KRL. STRUCs in KRL work similarly to structures in other programming languages.