Page 1 of 1

Restore <variable>

Posted: Wed Dec 29, 2004 4:15 am
by StarHawk
The ability for the Restore command to be followed by a variable and not just a label.

Example.

Code: Select all

random.b = Random(2)

Restore random
Read data.s

DataSection
1:
Data.s "blah blah"

2:
Data.s "blah blah"

EndDataSection

Posted: Wed Dec 29, 2004 2:04 pm
by tinman
Would it not be better if it used the value of the variable as the address to restore to, and not as the value of the label? Your example, would then look like this:

Code: Select all

Dim mylabels.l(2)
mylabels(0) = ?some_random_label
mylabels(1) = ?wertyui

random.b = Random(2)
Restore mylabels(random)
Read data.s

DataSection
some_random_label:
Data.s "blah blah"

wertyui:
Data.s "blah 2"
EndDataSection
Also far better to be able to use an expression, rather than just a variable.

More power, more ability to abuse things, more chance of screwing it up. But more fun :)