TLists as field?

BlitzMax Forums/BlitzMax Programming/TLists as field?

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'd like to have a type with a Tlist as a field, but for some reason i can't get this to work.

I want to be able to create a Live-O-Matic object, and add as much sequencers to it as i need. I don't get any errors, but the countSequencers function keeps saying the list contains 0 elements. What am i doing wrong here?

Global LOM:Live_O_Matic = Live_O_Matic.create()

DebugLog LOM.countSequencers()

Type Live_O_Matic

	Field sequencerList:TList
	Field num
	
	Method countSequencers()
		CountList sequencerList
	End Method
	
	Function create:Live_O_Matic()
		' init Live-O-Matic
		
		Local this:Live_O_Matic = New Live_O_Matic
		this.sequencerList:TList = CreateList()

		ListAddLast this.sequencerList, Sequencer.create(16)
		ListAddLast this.sequencerList, Sequencer.create(16)
	
		Return this
	End Function

End Type


Type Sequencer

	Field size%

	Function create:Sequencer(size:Int)
		' init sequencer
		Local this:Sequencer = New Sequencer
		DebugLog "> sequencer created..."
	
		Return this
	End Function

End Type