I have a situation where I need to dinamically set variables.
I want to set variables to strings in order those are choosed. For example: If user clicks first button var1 changes to value of specific string. If second button is clicked before other buttons, var1 changes to its value of string.
Let me know if there is other way of doing the same thing.
This was the way I used it:
var player = GetPlayer();
var n = player.GetVar("n_id"); //n_id is set by button click
var str1 = player.GetVar("str1"); //str1 is already defined as some string
var str2 = player.GetVar("str2"); //just like str2 and so on..
var p = eval('str' + n_id); //this line sets p to the value of str1 or str 2 or any other //depending on n_id
alert(p); // returns undefined