Cant read labels in functions ?

BlitzMax Forums/BlitzMax Beginners Area/Cant read labels in functions ?

PaulJG(Posted 2005) [#1]
Could this be a possible bug ?
test()

Function test()

RestoreData mydata

For a = 1 To 5
	ReadData info
	Print info
Next

#mydata
DefData 2, 4, 6, 8, 10
End Function

I get this error - "Compile Error:Label 'mydata' not found"


Bot Builder(Posted 2005) [#2]
hmm.. dunno. I'd suggest using incbin anyway, and reading from the file. Data is pretty obsolete now.


xlsior(Posted 2005) [#3]
Looks like it...

I'm sure you've already tried this, but simply moving the data outside of the the function into the main program will make it work:

test()

Function test()

RestoreData mydata 

For a = 1 To 5 
     ReadData info
     Print info 
Next

End Function 

#mydata
DefData 2, 4, 6, 8, 10



Beaker(Posted 2005) [#4]
Why would you want your DefData inside a function anyway?