top of page

AZSTOKE/ALGAZODIK

GameAudio & Art

15

Beginner

AZSTOKe_sample_tableSameFileBool

Check whether the specified file exists in the array

RANK
SNS SHARE

function Msg(param)

    reaper.ShowConsoleMsg(tostring(param).."\n")

end


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)

function Msg(param)

     reaper.ShowConsoleMsg(tostring(param).."\n")

end


  • Set Msg console output function


function tableSameFileBool(table,file)


  • Define a function to check whether a string is stored in an array.


local tableL = table

local fileL = file

local BoolL = false


  • Store the argument in a variable and initialize the return value variable (BoolL) with default 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


  • Repeat the process for the number of elements in the array, and change the value of the variable BoolL to the value stored in the array.

  • Set to true if it matches the variable (fileL), otherwise set to false.

  • If they match, exit the repeat process.

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.

No preparation required

- 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