I'd like to create a table using a dyn_dyn_string data type, and initialize it using an initializer rather than code. I tried the following, but it doesn't work as expected:
const dyn_dyn_string ddsMyTable = makeDynString(
makeDynString("a", "b", "c"),
makeDynString("1", "2", "3"),
makeDynString("x", "y", "z")
);
main(i)
{
dyn_string dsRow1 = ddsMyTable[1];
dyn_string dsRow2 = ddsMyTable[2];
dyn_string dsRow3 = ddsMyTable[3];
DebugN(dsRow1, dsRow2, dsRow3);
}
The output to the log is as follows:
WCCOAui1:[dyn_string 1 items
WCCOAui1: 1: "a | b | c"
WCCOAui1:][dyn_string 1 items
WCCOAui1: 1: "1 | 2 | 3"
WCCOAui1:][dyn_string 1 items
WCCOAui1: 1: "x | y | z"
WCCOAui1:]
The items in each dyn_string were concatenated into a single string. Each should have remained as 3 separate strings. It seems like there should be a makeDynDynString() function, but I couldn't find one so I tried using the makeDynString as seen above, which didn't work quite right.
So, the question is can I initialize a dyn_dyn_string using an initializer, and if so, how is it done?
Thanks,
Tom
How to initialize a \"dyn_dyn\" variable?
- tgdannemiller
- Posts:23
- Joined: Thu Apr 21, 2016 3:29 pm
How to initialize a \"dyn_dyn\" variable?
- buec
- Posts:28
- Joined: Tue Dec 07, 2010 3:09 pm
Re: How to initialize a \"dyn_dyn\" variable?
If you initialize your dyn_dyn_string with a dyn_anytype it should work:
const dyn_dyn_string ddsMyTable = makeDynAnytype(
makeDynString( "a", "b", "c" ),
makeDynString( "1", "2", "3" ),
makeDynString( "x", "y", "z" )
);
Regards
Christoph
const dyn_dyn_string ddsMyTable = makeDynAnytype(
makeDynString( "a", "b", "c" ),
makeDynString( "1", "2", "3" ),
makeDynString( "x", "y", "z" )
);
Regards
Christoph
- tgdannemiller
- Posts:23
- Joined: Thu Apr 21, 2016 3:29 pm
Re: How to initialize a \"dyn_dyn\" variable?
Thank you, that works!