i have a dictionary called pokemon and its like this
var pokemon : Dictionary = {
"charmander": 1
etc
}
and i want to store lets say dictname
as pokemon
so how would i do that kinda like if there was a var_name_to_string
function?
i have a dictionary called pokemon and its like this
var pokemon : Dictionary = {
"charmander": 1
etc
}
and i want to store lets say dictname
as pokemon
so how would i do that kinda like if there was a var_name_to_string
function?
Not sure that I follow, can you explain a little more? Maybe give some mock code doing what you would like to do?
I assume you are passing a variable to a function?
my_func(pokemon)
...
func my_func(dictionary_to_pass:Dictionary):
dictname = ??? #original dictionary variable name wanted here
The absolute easiest route here is just to add a name
element to your dictionaries.
var pokemon : Dictionary = {
"name": "pokemon",
"charmander": 1
etc
}
var pokemon2 : Dictionary = {
"name": "pokemon2",
"charmander": 1
etc
}
....
func my_func(dictionary_to_pass:Dictionary):
dictname = dictionary_to_pass["name"] #original dictionary variable name wanted here
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.