global init within type bug

BlitzMax Forums/BlitzMax Programming/global init within type bug

Robert Cummings(Posted 2005) [#1]
Type tCursor
	Field typ:Int
	Field pwr:Int
	Global cursor:tCursor = New tCursor
End Type
cursor.typ = 10


Results in:
Compile Error
Identifier 'cursor' not found



DStastny(Posted 2005) [#2]
You need to address the cursor as

tCursor.cursor.type=10

Its not a bug you have incorrect scope. The global cursor is member of tCursor

Doug Stastny


Robert Cummings(Posted 2005) [#3]
Ah, my misunderstanding. I was incorrectly advised that a global within a type, was actually global to the entire program.

Thanks for your clarification.

A final question: Are globals from within the type scope as fast as globals within the program scope?