In my opinion this make no sense, as you could simply doi like
this:
Const Level_001:Int = 500
Local OutputVariable:Int = Level_001
This was my first thought, but then I have got your idea behind this. You want to get your LevelInfo from a String, maybe you have const like Level_001, Level_002 etc.
Then this will maybe help you:
Type TLevelData
Field ID:Int
Field Difficulty:Int
Function Create:TLevelData(ID:Int , Dif:Int)
Local L:TLevelData = New TLevelData
L.ID = ID
L.Difficulty = Dif
Return L
End Function
Method ToString:String()
Return "Level : " + ID + " With Difficulty : " + Difficulty
End Method
End Type
Local Map:TMap = New TMap 'Init a new balanced binary tree
'Inserting Keys with created Values as Leveldata
For Local I:Int = 0 To 99
Map.Insert( ("Level_" + I) , TLevelData.Create(I , I * 500) )
Next
'Reading Randomly Level datas from the TMap
For Local I1:Int = 0 To 10
Local Value:String = ("Level_" + Rand(0 , 99) )
Local Level:TLevelData = TLevelData(MapValueForKey(Map,Value) ) ' Attention You need to cast the value back to TLevelData because MapValueForKey only returns an'Object'
Print Level.ToString()
Next