Author Topic: Variable names, Can they contain other variables?  (Read 5694 times)

szeliga90

  • Guest
Variable names, Can they contain other variables?
« on: May 28, 2016, 12:37:04 PM »
Is there any way to use content of one variable as a part of the name of other variable?

I've try something like this:
http://imagizer.imageshack.us/a/img924/248/twniMT.png
But it doesn't allow for colons in variable name, so I guess this is not the way. I would be very grateful for quoting part of VA manual which contain information about it. If it is possible at all.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2826
Re: Variable names, Can they contain other variables?
« Reply #1 on: May 30, 2016, 10:20:54 PM »
Hi, there.

Currently, variable names are very rigid.  There are no ways to express variables other than by their actual name. 
I *do* however, have it on the books and have a strong need for variable names that accept tokens as part of the name to be rendered at run-time.  This, however, requires me to fix up the way tokens are parsed and allow nested tokens (this is a high-priority item, actually).  So, once I have those two things in place, we can have stuff that simulates arrays... which means that VA will probably need to have scoped variables (not just global).  Doesn't end LOL;)

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: Variable names, Can they contain other variables?
« Reply #2 on: May 31, 2016, 01:23:29 AM »
Hi, there.

Currently, variable names are very rigid.  There are no ways to express variables other than by their actual name. 
I *do* however, have it on the books and have a strong need for variable names that accept tokens as part of the name to be rendered at run-time.
Wouldn't be simpler and faster to parse,  instead of variable names derived from token concatenation, to expose a Dictionary option for the already supported data types?

Say, in the "Set a <T> value" dialog, adding an optional "Assign a key <key>" textbox, and then, simply allow for the syntax

{<T>:MyVarName(<key>)}

when parsing the tokens

I guess you are now, internally, storing all the variables of a same type as
Dictionary (of String, T)

so that would simply change those to
Dictionary (of String, Dictionary (of String, T))

which would cover both the current "single value" behaviour and the new one easily

Just a thought...  ;)
« Last Edit: May 31, 2016, 01:27:02 AM by Antaniserse »
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin