 |
Cbisazza Wanderer
Joined: 27 Feb 2003 Posts: 69 Location: Australia
|
Posted: Mon Sep 01, 2003 8:40 am
Nested Record Variables? |
I'm trying to create a nested record variable which does not want to work.
To illustrate, if I run this code snippet ...
#VAR List {list1|List2|List3}
#VAR do.List1.test test1
#VAR do_list1.test test1
#SAY This is .... @{do.@{List.1}.test}
#SAY this is 4 .. @{do_@{List.1}.test}
Then I get:
This is ....
this is 4 .. test1
The nested Record variable does not seem to work.
Reading the intro to variables on the web page, however, it says:
In zMUD v6.20 and later, record variables were improved, much like string lists, to fix problems with nested values. Now you can store string lists, or other record values into record elements. You can also nest the syntax used to reference elements. For example, if we stored a string list into a record variable:
This seems to imply that it can be done ... although I'm not really sure that that's what is implied by "record values".
So ... Is there some trick to this, or is this not possible?
While the workaround is easy (i.e. use an underscore as in the example above), this generates LOTS of variables, and I would like to avoid this if it's simple to group related variables together.
Thanks, |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Sep 01, 2003 6:37 pm |
Reading the "Database Variables" topic in the builtin zMUD help, it says:
The second way to access database variables is using standard C and Pascal "dot notation" where you specify the VarName.FieldName. For example @VarName.Name1 will return Value1. However, this shortcut notation does not allow a variable field name. @VarName.@FieldName WILL NOT WORK! So, while it is useful most of the time, sometimes you will still need the %db function. (emphasis added)
Since this states that you can't use names such as @do.@List, it seems to imply that you can't use names such as @do.@{List.1} either and that would seem to imply that you wouldn't be able to use names such as @do.@{List.1}.test.
There's no trick, just the standard use of the %db and %item functions.
%db( @do, @{List.1}.test) will work.
%db( @do, %item( @List, 1).test) will work. |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|