![]() |
Forum Index : Microcontroller and PC projects : Pass an Array *name* to a SUB?
Author | Message | ||||
toml_12953 Guru ![]() Joined: 13/02/2015 Location: United StatesPosts: 383 |
Is there any way to pass the name of an array to a SUB? I don't want to pass the array itself but rather the name of the array so I can use a single call that selects between MATH M_PRINT and MATH V_PRINT without worrying whether the table in question is an array or a vector. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7464 |
Pass both but use the zeroeth value or a flag to indicate which task you want? I can't se how you could pass a name other than as a string. If you did that the string itself could be the array, but you may need to copy it into a proper local array to manipulate it. Edited 2025-04-23 17:47 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1121 |
Could you use the Bound function to determine the dimensionality (?) of the passed array? Visit Vegipete's *Mite Library for cool programs. |
||||
toml_12953 Guru ![]() Joined: 13/02/2015 Location: United StatesPosts: 383 |
Hmmm. That might work. I'll investigate. Thanks! |
||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
pass it as string and then single :Execute "Dim " + yourstring$ + "(" + Str$(your_value) + ")" Two dimensional: Execute yourstring + "(" + Str$(your_value) + "," + Str$(your_value) + ") = " + Str$(your_value) If you want to see what your code is doing replace the execute with print. Edited 2025-04-25 02:47 by dddns |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |