top of page

13

Beginner

AZ_textTableChanger

カンマ区切りの文字列を分割して取得

RANK

dofile(reaper.AZ_GetLuaInitPath())


function textTableChanger(table,str,Number,Count)

    local a = table local a = {} local b = Count local c = Number local d = 0 local e = 0

for word in str:gmatch("([^,]*)") do

    c = c +1

    if b > 1 then

        if d == 0 then e = e+1 a[e] = {}end

            d = d +1

            a[e][d] = word

            if d == Count then d = 0 end

            else

                 a[c] = word

            end

      end

      return a

    end


text = "1,2,3,4,5,6,7,8"

c = {}

c = textTableChanger(c,text,0,1)

Msg(c[3])


c = {}

c = textTableChanger(c,text,0,2)

Msg(c[4][2])


c = {}

c = textTableChanger(c,text,0,3)

Msg(c[3][1])

dofile(reaper.AZ_GetLuaInitPath())


function textTableChanger(table,str,Number,Count)


  • カンマ区切り文字列を配列に格納する関数を定義する。


local a = table local a = {} local b = Count local c = Number local d = 0 local e = 0


  • 引数を変数に格納し、カウント用の変数を0で初期化する。


for word in str:gmatch("([^,]*)") do

c = c +1


  • 引数(str)をカンマで分割し、分割後の文字列の数だけ以下5~6の処理を繰り返す。繰り返すたびに変数(c)を加算する。


if b > 1 then

if d == 0 then e = e+1 a[e] = {}end

d = d +1

a[e][d] = word

if d == Count then d = 0 end


  • 変数(b)(引数のCount)が1より大きい場合、変数(d)が0であれば変数(e)に1加算し配列の(e)番目に空の配列を格納する。

  • 変数(d)に1加算し、配列の(e)番目に格納された配列の(d)番目に4で分割した文字列を格納する。

  • 変数(d)が引数(Count)と同値になれば(d)を0に初期化する。

To use the API, you need to sign up for a plan.

Download the dedicated API

need to do it.

*SILVER is scheduled to be released in May.

準備の必要はありません

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

LUA

​ReaScript File Download 👇

* A dedicated API is required to run this

- Script Image -
bottom of page