Redefining variable types

BlitzMax Forums/BlitzMax Programming/Redefining variable types

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

There are various ways you could approach this.

1) Try to create a generic save file structure at the beginning.
2) Have an identifier in your save file that identifies the file version, and have a loader for each version the application supports (you can drop old file versions after a couple of revisions).
3) Load the file and default missing values.
4) A combination of the above.

If you think your datatypes may change, you could always save them as a string, and typecast them at load time for example:
Local data$ = "1.6"

Local nInt% = Int(data)
Local sStr$ = String(data) 
Local nFlt# = Float(data) 

Print "Integer: " +nInt
Print "String: " +sStr
Print "FLoat: " +nFlt


A simple "extends" might be suitable too:
type TTwo extends Tone
field x$
end type

global hah:Tone