in a program I need a datasection where a lot of pairs of an integer value and a string are defined and read in. In the PB docs the examples only show multiple values of the same type separated by comma, so I think of using something like
Code: Select all
DataSection
mylabel:
Data.i 1
Data.s "TextABC"
Data.i 17
Data.s "SomeText"
...
EndDataSection
Coming from good old GFA Basic there no type needs to be defined, so there it was possible to do it with
Code: Select all
DATA 1,"TextABC",17,"SomeText"
I've found out, that something like
Code: Select all
DataSection
mylabel:
Data.i 1,"TextABC",17,"SomeText"
EndDataSection
Restore mylabel
Read.i num(1)
Read.s txt(1)
Read.i num(2)
Read.s txt(2)
But as this isn't documented in the (german) help, I would like to be sure, that this is an accepted way, that will not be killed by an update ob PB in the future.
My only other idea would be to put the numbers into the string and use a separating char between number and string, define and read only strings and split them with StringFields.
Or does anyone have a tip to make it better? As in real life the data list is really long, it is not possible to first define all numbers and then define all strings.
I've tried to find other solutions, but the keywords DataSection, Data und Read are used a bit to often.
Greets, hoerbie