iterating through types as a function?

Blitz3D Forums/Blitz3D Programming/iterating through types as a function?

I'm writing something where I need to iterate through a type to find the one with a particular \ID, and then grab some other \values from it.

Rather than insert that code each time I need to do that, I'm inserting an external function to iterate through the types until it finds the one with the right id, then ending.

My question is this: once I end the function and return to the main program, will that type item still be the active one?

I'm not making this very clear: okay, I have type TRUCK. I want to iterate through until TRUCK\ID$ = "bigtruck", and then make x# = TRUCK\x# etc etc.

Can I use a function like this:
Function findtruck( id$ )
   truck.truck = First truck
   While truck\ID$ <> id$
      truck = After truck
   Wend
End Function

... and then in the main program use this:
blah blah
findtruck( "bigtruck" )
x# = truck\x#
etc

Or will it happen so that when the function ends and returns to the main program, the truck\x# I use will again be the First truck?