Restore <variable>

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
StarHawk
User
User
Posts: 55
Joined: Sun Nov 02, 2003 7:27 am

Restore <variable>

Post 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
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post 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 :)
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Post Reply