I need to know how to do something like how in Lua you would use:
foo={
x=7,
y=5
}
and retrieve the variables with foo.x
. Thank you!
I need to know how to do something like how in Lua you would use:
foo={
x=7,
y=5
}
and retrieve the variables with foo.x
. Thank you!
You're looking for a dictionary, where you're able to access key , value pairs.
foo={
'x':7,
'y':5
}
the semicolon is used to assign the key to the value
foo = {
'key':value
}
Use a python Dictionary type:
foo = {
'x' : 7,
'y': 5
}
Retrieve with: foo['x']
Here's the official documentation: https://docs.python.org/3/tutorial/datastructures.html#dictionaries