any way to access function..n?

Discuss any general programming issues here
Post Reply
Posts: 917
Joined: Sun Feb 14, 2010 7:11 pm

any way to access function..n?

Post by Bugala »

I happen to have a situation where it would be very convinient to be using "for n=1 to x" to perform what I am doing, however, i have basically double trouble.

part of the line is to access func1, func2, func3.

And another is var1, var2, var3 type of thing.

so what i would in effect need is:

Code: Select all

for n=1 to 3
myfunction(var..n, func..n)
For var1, var2, i could see a possibility for using g["var"..n] to access it, but in this case they happen to be local variables, i guess local variables are not stored in global variables list at any point?

So any possiblity to access these without putting them first in list?

for i could have:

Code: Select all

myfunclist = {func1, func2, func3}
myvarlist = {var1, var2, var3}
and then access it:

Code: Select all

for n=1 to 3
myfunction(myvarlist[n], myfunclist[n]
next n
But is this the only way i can do it?

Posts: 309
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: any way to access function..n?

Post by SamuraiCrow »

Of course there are other ways but the most effective way would be to make your existing wrapper tables into one so that each entry would have a var and a func field.

Code: Select all

Then call it with

Code: Select all


Code: Select all

I'm on registered MorphOS using FlowStudio.

Post Reply