Maps inside Maps?

Monkey Forums/Monkey Programming/Maps inside Maps?

NoOdle(Posted 2011) [#1]
Im trying to create maps that holds both string keys and string values. These maps are stored in another map...

only problem is I can't find the correct syntax.. I've tried a lot of different things! Anyone know if this is possible? (its possible in bmax but that may not mean much)

Below is non working code...




muddy_shoes(Posted 2011) [#2]

Import mojo


Global Dictionary : StringMap<StringMap<StringObject>> = New StringMap<StringMap<StringObject>>
Global SubDictionary : StringMap<StringObject> = New StringMap<StringObject>



Class myTest Extends App

	Method OnCreate()
		SetUpdateRate( 60 )
		
		Dictionary.Set( "Cube", SubDictionary )
		
		SubDictionary.Set( "X", "150" )
		SubDictionary.Set( "Y", "100" )
		
	End Method
	
	Method OnUpdate()
	End Method
	
	Method OnRender()
		Cls 0, 0, 0
		
		SetColor 255, 255, 255
	
		Local this : StringMap<StringObject> = Dictionary.Get( "Cube" )
		
		DrawText this.Get( "X" ), 10, 10
		DrawText this.Get( "Y" ), 10, 25
		
	End Method

End Class



Function Main()
	New myTest
End Function



JIM(Posted 2011) [#3]



NoOdle(Posted 2011) [#4]
Thanks a lot muddy_shoes that is perfect! :)


Gamer(Posted 2012) [#5]
Yea thanks muddy :D