Convert Object to User Type Value

BlitzMax Forums/BlitzMax Programming/Convert Object to User Type Value

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

To sort out different User Types. Not all Values in the "ActObj" Array are the same.
For Local Lad:Ladder = EachIn ActObj will give you only the ladders. Still want to do it the hard way?

Strict

Type A
    Field a = 5
End Type

Type B
    Field a = 10
End Type

Local actobj:Object[32]

For Local i:Int = 0 To 31 Step 2
    actobj[i] = New A
    actobj[i+1] = New B
Next

For Local woo:A = EachIn actobj
    Print woo.a
Next

For Local woo:B = EachIn actobj
    Print woo.a
Next