error with list.Node

Monkey Forums/Monkey Programming/error with list.Node

Jesse(Posted 2011) [#1]
anybody have an idea why I am getting this error:
	Field node:list.Node<Tball>


I get error:

Module 'list' not found



I did import the Mojo module.


ziggy(Posted 2011) [#2]
Have you modified your monkey module somehow?


Jesse(Posted 2011) [#3]
No, Not at all.
to make sure I downloaded just now and run it but still get the same error.


AdamRedwoods(Posted 2011) [#4]
Does this work?
Import monkey.list


Jesse(Posted 2011) [#5]
no. I get a "duplicate Identifier error." here:
Global list:List<Tball>



ziggy(Posted 2011) [#6]
Does a single file with just this compile in your Monkey setup?
Function Main()
	Local a:list.Node<MyClass>
End Function

Class MyClass

end



Jesse(Posted 2011) [#7]
Yes, It works.
Also, I tried putting it in a global in the main program and it doesn't give me any errors but using it as a field or a global in that class does:
maybe something else is wrong with that class:

Class Tball Extends vector
	Field pc:TPoint
	Field rollx:Float
	Field rolly:Float
	Field roll:Float
	Field radius:Float 
	Field number:Int
	Field mass:Float
	Field color:Int
	Field vtxList:List<vertex>
	Field stp:Float
	Field node:list.Node<Tball>
	


the vector class only contain the fields vx,vy,dx,dy and length


ziggy(Posted 2011) [#8]
It's difficult to tell without having the complete source code.


Jesse(Posted 2011) [#9]
I'll try to figure it out by elimination if I can't solve it I'll post the source code. either way I'll post my results.


Jesse(Posted 2011) [#10]
well, I got it to the minimum it will give me the error. It seems that it can't mingle arrays of <T> with nodes of <T>. or simething like that.
Import Mojo

Global ball:Tball[16]
Global list:List<Tball>

Function Main:Int()
	ball[0] =  Tball.Create(0,0,10,$FFFF00, 1,50,0,0)
	ball[0].node = list.AddLast(ball[0])
End Function


Class Tball
	Field node:list.Node<Tball>
	
	Function Create:Tball(x:Int,y:Int,r:Int,color:Int,num:Int,m:Float,vx:Float = 0,vy:Float = 0)
		Local c:Tball = New Tball
		Return c
	End Function
	
End Class


it smells of a monkey bug to me.


Jesse(Posted 2011) [#11]
can this thread be moved to the monkey bug section or should I start a new one?


therevills(Posted 2011) [#12]
This compiles:

Import Mojo

Global ball:Tball[16]
Global ballList:List<Tball>

Function Main:Int()
	ballList = New List<Tball>
	ball[0] =  Tball.Create(0,0,10,$FFFF00, 1,50,0,0)
	ball[0].node = ballList.AddLast(ball[0])
End Function


Class Tball
	Field node:list.Node<Tball>
	
	Function Create:Tball(x:Int,y:Int,r:Int,color:Int,num:Int,m:Float,vx:Float = 0,vy:Float = 0)
		Local c:Tball = New Tball
		Return c
	End Function
	
End Class


BTW: ewwww at Tball... just use Ball ;)


Jesse(Posted 2011) [#13]
I am an Idiot!
thanks Therevills.

that should do it. although, I don't know why the error wasn't more specific.


BTW: ewwww at Tball... just use Ball ;)



just a port from BlitzMax. I thought about renaming it before posting it for that same reason.




/