passing a type to a function

Blitz3D Forums/Blitz3D Beginners Area/passing a type to a function

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

I want to do this:

Function Update()
   for t.thing = Each thing
      If t\thing_type$ = "window" Then UpdateWindow()
   Next
End Function

Function UpdateWindow()
   Rect w\window_x, w\window_y, 32, 32, 0
End Function
I could do this:
Function Update()
   for t.thing = Each thing
      If t\thing_type$ = "window" Then UpdateWindow(w\window_x, w\window_y)
   Next
End Function

Function UpdateWindow(wnd_x, wnd_y)
   Rect wnd_x, wnd_y, 32, 32, 0
End Function
But i don't want to use locals (wnd_x, wnd_y) if i can do it without them.

You could do

for t.thing = each thing
updatewindow(t)
next

function Updatewindow(t.thing)
rect t\windowx,t\windowy,32,32,0
end function


Works perfect :D thanks