top of page

Beginner

12

Sort an array based on the elements in the array

RANK

AZSTOKe_sample_sorted

def Msg(parm):

   RPR_ShowConsoleMsg(str(parm) + "\n")



t = ["A","C","B","D"]

x = []


for index, value in enumerate(t, 0):

    x.insert(index, {})

    x[index]["name"] = value

    x[index]["index"] = index


y = sorted(x, key=lambda t:t["name"])

Msg(y)

def Msg(parm):

   RPR_ShowConsoleMsg(str(parm) + "\n")


  • A function that outputs the input value to the Reaper console


t = ["A","C","B","D"]

x = []


  • t : Prepare name array

  • x: Prepare an array for input


for index, value in enumerate(t, 0):

    x.insert(index, {})

    x[index]["name"] = value

    x[index]["index"] = index


  • Rotate For by array of t

  • Set array to x according to index of for

  • x "name" is value "index" is index


y = sorted(x, key=lambda t:t["name"])

Msg(y)


  • Sort by name of key of x and register in y

  • Output y to Msg function

APIの利用にはBRONZEに

加入し専用APIを

ダウンロード

する必要があります。

No preparation required


- Script Code -
- Script Image -
- Warm Up -
- Script Detail -
- API -

PYTHON

​ReaScript File Download 👇

​※実行するには専用APIが必要です

- Script Image -
bottom of page