I have a code block that I want to reuse with a slightly different reference, it has a with statement at its start - with db(place). db is a type, and db(place) is an array of this starting at 0.
I also have a pointer *objects which links to db via objects(object), I guess you could think of this as a key for just objects where as db is everything.
I want to reuse the block and replacing the with db(place) with, with *objects(obj) will do this, but I really do not want to duplcate everything. I don't think I can use a simple if (have not tried this yet), though free basic has surprised me in the past.
Code: Select all
if x then with db(place)
else with *objects(obj)
so can I use a pointer and pass the pointer to a sub? If so how would I set the pointer up so that it can point to either db(x) or *objects(x) and how would I pass this to the sub? Finally once inside the sub would with *pointer_name(x) be sufficent or do I need something else?
Thanks in advance.