Can I pass table elements as variables (“passed by reference” parameters) into subroutines?
I want to pass a table element, have the subroutine update it, and then send it back to the same table.
I’m having trouble making this work and results in having to make unique temporary tables to pass variables back and forth in each chart that I call the subroutine… which mostly defeats the purpose of using it.
You have to pass the entire table if you want to modify an element in that table. The other option is to pass the table elements value to the subroutine, and then write it to the table after the subroutine returns.
Edit: You can also pass the table as a parameter along with the index that you want to have modified.
Oops, well good to know. I think passing the entire table should work pretty well for me. I’m passing a few tables but the index will be the same for all of them so that makes it easy.