Sign in to follow this  
Followers 0
RandomClown

Functions: Make New Vars

3 posts in this topic

#1 ·  Posted (edited)

Hello, I was wondering if it was possible to take a variable name in a function & make a new variable based on the name.

======== Details ========

//  This is an example:

Stat($Number) //gives me a new var: $NumberLen

Func Stat($Input)

    - Make Var $NumberLen: $Input + "Len"

    $Input + "Len"=Len($Input)

EndFunc

Thanks for reading

PS: Now that I think of it, this actually seems silly.

But since I was wondering in the 1st place, it wouldn't hurt to find out.

A good programmer learns new tricks. [at least I should hope so]

Edited by RandomClown

Share this post


Link to post
Share on other sites



Check out Eval and Assign.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Why do you want to do this? it's a dirty trick that shouldn't be used. There's 100% guarantied a better way to solve your problem.

Edit: Also, text looks silly in a monospaced font.

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
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
Sign in to follow this  
Followers 0