Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Token Pasting


2 replies to this topic

mikejobu

mikejobu
  • Full Members
  • 2 posts

Posted 10 May 2008 - 01:34

Looking for token pasting.

In C I would use ##

Like:

int var1 = 6;
int num = 1;

// prints 6
printf( "%d", var##num );

// The ## takes the value and pastes it to the name
// so var##num essentially becomes var1


Can this be done in installscript?


Bascially I have a string ("VAR=5")

and I want to parse and get

"VAR" and "5"

And then somehow set the variable named VAR to be 5

VAR=5

how?





Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 11 May 2008 - 17:52

No, I don't think that's possible, unlesss you resort to an array, something like:

var[1] = 6;
num = 1;
Sprintf(svString, "%d", var[num]);

mikejobu

mikejobu
  • Full Members
  • 2 posts

Posted 11 May 2008 - 22:21

QUOTE (Stefan Krueger @ 2008-05-11 17:52)
No, I don't think that's possible, unlesss you resort to an array, something like:

var[1] = 6;
num = 1;
Sprintf(svString, "%d", var[num]);

No - cant do it by array.

Ok - I figured it was a little to advaced for installscript - altho there is some way to access the variable names via a stack as the debugger does it...

Does anyone know of how to simply access the namespace of the variables defined globally?


Again - prob too advanced to find this info anywhere - I will play a bit and see.

Thanks!