user10604546
user10604546

Reputation:

Write an ini key with name of variable value

I am trying to create an ini-database for every user that typed /boot (something). But the problem is that I cannot write to ini. I need to do that:

Write into an ini section "boots" a key with a name of value of variable bootuserid. This is what I tried:

boots.'${bootuserid}'

boots.$bootuserid

boots.${bootuserid}

boots.(bootuserid)

All the scripts failed. So how do I make an ini key name of a value of variable?

Upvotes: 3

Views: 93

Answers (1)

swagrov
swagrov

Reputation: 1460

You can use bracket notation to access a variable name with another variable:

boots[bootuserid]

I.e.

a={b:1}
myvar="b"
a[myvar] //returns 1

Upvotes: 2

Related Questions