for loop.object = each object

Blitz3D Forums/Blitz3D Beginners Area/for loop.object = each object

DaxTraj(Posted 2004) [#1]
is there a way to make the "loop" global ?

I need to loop through a type collection like this:

for loop.object = each.object

update_xy_pos()

next

--------------------------------

Function update_xy_pos()

loop.object\x = 10
loop.object\y = 20

End Function


Jeppe Nielsen(Posted 2004) [#2]
Global loop.object

But I dont think you can have a type called object, as it is a reserved blitz command.


Beaker(Posted 2004) [#3]
for loop.object = each.object

update_xy_pos(loop)

next

;--------------------------------

Function update_xy_pos(loop.object)

loop.object\x = 10
loop.object\y = 20

End Function


DarkNature(Posted 2004) [#4]
Do this:
update_xy_pos(loop)
to pass 'loop' (the current instance of type 'object') as an argument to the function update_xy_pos().

To receive the type reference at the function end, do this:
function update_xy_pos(this.object)


Have fun.


DaxTraj(Posted 2004) [#5]
great - thanks