Accessing structures' children with variables

Hi all (my first post).

I was trying to access a structure’s child with a dynamic name provided by a string variable, but that wasn’t working.
Then I found that by explicitly casting it with VariableString it worked.
So, it seems to me that using a variable as the child name uses the variable object itself rather than its value as the key. Am I wrong?

World[Variable(Index)] ← not using Index value (although Index is of type string)
World[VariableString(Index)] ← using Index value

(Thanks)

There are no variable objects or implicit casting. Variable() is an expression that gets a numerical value of a variable and returns it, just like VariableString() gets a text value from a variable and returns that string. Thus if your variable is a string and you want to use that string as key, there is no way Variable would work in that case. On the other hand, if you were using an array or a mapping of numbers to something else, you’d want to use Variable instead of VariableString.

Thanks, now it’s clear (yes, I thought that Variable() returned some object and not the numeric value).