PDA

View Full Version : running a command from a variable?


bachus
03-27-2007, 04:13 AM
Hello all,

I was wondering if it is possible to store commands in variables, then execute the commands through the variable name?

Say,
frame 1:
var varcommand=stop();
frame 2:
varcommand;

I ponder this, as I would like to load variables from a text file that are specific commands.

Is it possible? If not, any suggestions to accomplish this another way?

I appreciate any help, and thanks in advance.

dimitri
03-31-2007, 11:27 PM
I've been trying to find this out too. Have you had any luck finding an answer?

dimitri.

WhidbeyTomas
04-02-2007, 01:07 AM
My first reaction is, why not? We do this all the time with simple snippets of code. For example, we will use a variable to hold a value and include this variable in code. The best way to answer this question is to try it.

The only problem I can think of is with type casting. If your code is all string, then your are fine, but when your code includes numeric values, there might be a problem. You two obviously have some scenario in mind, why don't you try it and let us know the results?