Data

Blitz3D Forums/Blitz3D Programming/Data

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

I love such questions, really.

Anyway. Data lets you store data inside the code without to preassign it to a variable. Example

restore pink
read red
read greed
read blue
color red,green,blue
print "hello world"

restore yellow
read red
read greed
read blue
color red,green,blue
print "now somethin completely diffrent :P"

.pink
Data 255,0,255

.yellow
data 255,255,0

theoreticly you could use Data to convert an Image to Data and then create it on the fly. But there's a problem, it will use much more RAM than if you simply load it from the HD.

Data is a very old Basic Command. I guess it comes from the Assembler Languages "Data Segment". In prehistoric times a program had a Text-Segment (machinecode), a data segment (data) and some other segments, and all the segments where limited to 64 Kilobytes due to the 16 Bit adressing methods of those dino-chips. Anyway, Data still may be useful in some cases.