top of page

15

Beginner

AZ_tableSameFileBool

配列の中に指定のファイルの有無を確認

RANK

dofile(reaper.AZ_GetLuaInitPath())


function tableSameFileBool(table,file)

    local tableL = table

    local fileL = file

    local BoolL = false

    for x, value in pairs(tableL) do

         if tableL[x] == fileL then

             BoolL = true

             goto e

        else

             BoolL = false

        end

    end

 ::e::

return  BoolL

end


t = {10,20,30,40,50}

a = tableSameFileBool(t,30)

Msg(a)

dofile(reaper.AZ_GetLuaInitPath())


function tableSameFileBool(table,file)


  • 配列内に文字列が格納されているか確認する関数を定義する。


local tableL = table

local fileL = file

local BoolL = false


  • 引数を変数に格納し、戻り値用の変数(BoolL)をデフォルトfalseで初期化する。


for x, value in pairs(tableL) do

if tableL[x] == fileL then

BoolL = true

goto e

else

BoolL = false

end

end

::e::

return  BoolL


  • 配列の要素数だけ処理を繰り返し、変数BoolLの値を配列に格納されている値が

  • 変数(fileL)と一致すればtrue、しなければfalseとする。

  • 一致した場合繰り返し処理を抜ける。

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