|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello,
Is there some sort of way, other than to use a switch statement, to do this:
[ignore the loop, its the variable I am interested in]
#local var0 = foo;
#local var1 = foo;
#local var2 = foo;
while J<2{
while Jx<num{
#local Positions[J][Jx] = <0,var+J,0>; // so that it would be processed as
var0 etc..
}
}
Normally one could accomplish this quite easily in any other language...and
I am guessing this is possible in sdl as well...
Thanks,
ian
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
[GDS|Entropy] <gds### [at] hotmailcom> wrote:
> #local Positions[J][Jx] = <0,var+J,0>; // so that it would be processed as
> var0 etc..
> Normally one could accomplish this quite easily in any other language...and
> I am guessing this is possible in sdl as well...
I don't know of any language which would interpret "var+J" as anything
else than the sum of the values of 'var' and 'J'. Also, I don't know many
languages which support creating variable names from expressions and then
interpreting those variable names (maybe PHP is one of them).
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In most languages there'd be an eval() statement.
In POV SDL there's a nasty Parse_String() macro in strings.inc
#include "strings.inc"
#declare var0 = "foo";
#declare var1 = "bar";
#declare var2 = "baz";
#declare J=0;
#while (J<3)
#declare A = concat("var",str(J,1,0));
#debug concat(Parse_String(A),"\n")
#declare J=J+1;
#end
It is much nicer, and more efficient, to create var as an array and use
var[J].
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hey Warp,
Actually, you're right.
For some reason I was thinking of this:
"string" + variable + "string"
And logically, after a very long day, I completely invert the concept.
Sheesh...I really don't get enough sleep.
I do apreciate your help.
Ian
"Warp" <war### [at] tagpovrayorg> wrote in message
news:4796f8a2@news.povray.org...
> [GDS|Entropy] <gds### [at] hotmailcom> wrote:
>> #local Positions[J][Jx] = <0,var+J,0>; // so that it would be processed
>> as
>> var0 etc..
>
>> Normally one could accomplish this quite easily in any other
>> language...and
>> I am guessing this is possible in sdl as well...
>
> I don't know of any language which would interpret "var+J" as anything
> else than the sum of the values of 'var' and 'J'. Also, I don't know many
> languages which support creating variable names from expressions and then
> interpreting those variable names (maybe PHP is one of them).
>
> --
> - Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|