Author Topic: Массив переменных  (Read 1603 times)

0 Members and 2 Guests are viewing this topic.

John Smith

  • Jr. Member
  • **
  • Posts: 18
  • Karma: 1
    • View Profile
Массив переменных
« on: November 21, 2020, 11:43:03 AM »
Есть ли возможность создать в VC одномерный массив переменных без использования Python?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Массив переменных
« Reply #1 on: November 21, 2020, 03:08:05 PM »
Not exactly but you can achieve something similar either by using the action Results.SetVar
https://voxcommando.com/mediawiki/index.php?title=Actions#SetVar

Or by using map tables.
https://voxcommando.com/mediawiki/index.php?title=Maps

The best choice will depend on how you want to use the values.

John Smith

  • Jr. Member
  • **
  • Posts: 18
  • Karma: 1
    • View Profile
Re: Массив переменных
« Reply #2 on: November 22, 2020, 10:44:59 AM »
Yes, I often use «SetVar» and «Maps», but they only allow me to create individual variables, and I need an array, whose elements can be accessed through an index.
For example:

value = [10, 20, 30, 40, 50, 60]
a = value[0]
b = value[1]

Probably, this can only be implemented through global variables in Python.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Массив переменных
« Reply #3 on: November 22, 2020, 02:49:06 PM »
You can still use single variables as an array like this:

value1=10
value2=20
value3=30
value4=50.

Or if you are only interested in numbers you can store them in a single vairable separated by commas.

value = 10,20,30,40,50

Or you can use maps tables.

But then again, I can't think of any reason why you would not want to use Python.

As I said, it will really depend on how you want to use them.  We don't know enough about what you are trying to do, for us to be able to offer a full solution.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Массив переменных
« Reply #4 on: November 22, 2020, 02:55:47 PM »
If you want to use map tables.  You can think of the map table as the array, and the key as the index of the array.

If you want to set the 3rd index of an array using a map, like:   MyArray[3]=30

Map.Set    MyArray   3    30

and later you can retrieve it.

Map.Get   MyArray   3