passing a type to a function
Blitz3D Forums/Blitz3D Beginners Area/passing a type to a function
| ||
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 FunctionI 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 FunctionBut i don't want to use locals (wnd_x, wnd_y) if i can do it without them. |
| ||
You could dofor 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 |