top of page
- Script Code -

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)

- Warm Up -

No preparation required

- Script Detail -

ofile(reaper.AZ_GetLuaInitPath())


function tableSameFileBool(table,file)


  • Define a function that checks whether a string is stored in an array.

local tableL = table

local fileL = file

local BoolL = false


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


  • Iterate through the array elements, and set the value of the variable `BoolL` to `true` if the value stored in the array
  • matches the value in the variable `fileL`, and to `false` otherwise.
  • If there is a match, exit the loop.
- API LINK -
- API LINK -

Beginner

AZ_table_Same_File_Bool

Check if the specified file exists in the array

01_BRONZE_ss_edited.png
01_SILVER_edited_edited.png
03_GOLD_edited_edited.png
bottom of page