A
A
Aezakmivk2019-11-19 20:05:11
In contact with
Aezakmivk, 2019-11-19 20:05:11

How to setup eval?

There is a balances.json file. It contains the following:

{
    "uid": 0,
    "balance": 300,
  }

I want to make it so that I write to the bot, for example,
eval balances[0]
And he will display those same 2 lines from the file right in the conversation. Or, for example, I'll write
eval balances[0].balance = 500
And it will change the value of 300 to 500 in the file and save it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
2
2CHEVSKII, 2019-11-19
@2chevskii

eval() is raised in the current context, so if the variable is accessed, get its value as well. But in this case, using eval is stupid and dangerous, you can do without it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question