TLists as field?

BlitzMax Forums/BlitzMax Programming/TLists as field?

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


Because you arent returning any value. You probably want to try "return CountList(sequencerList)".

erm....for some reason i think i could've thought of that myself :)

shame on me

thanks though ;)