Jump to content

Using a Variable Variable


Recommended Posts

Is it possible to use a string contained within a variable as the variable name itself? For example:

CODE
Dim Array1[2]

Dim Array2[2]

Func Velocity($Name)

$Name = "$Array" & $Name

;Return velocity of array

EndFunc

Velocity(1)

Velocity(2)

In the function "Velocity" the string contained within $Name varies. Can the contents of $Name be used as the variable name, or perhaps there is another way to do this? This is just an example of what I am trying to do, the real thing is more complicated. Thank you.

Link to comment
Share on other sites

You can use Assign

Assign ( "varname", "data" [, flag] )

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...