top of page
- Script Code -

dofile(reaper.AZ_GetLuaInitPath())


function tableSameFileNum(table,file)

local t = table

local f = file

local c = 1

for x, value in pairs(t) do

if t[x] == f then

c = x

goto e

else

c = nil

end

end

::e::

return c

end


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

a = tableSameFileNum(t,30)

Msg(a)

- Warm Up -

No preparation required

- Script Detail -

dofile(reaper.AZ_GetLuaInitPath())


  • Loading the initial settings for the Lua version of RIGDOCKS


function tableSameFileNum(table,file)


  • Define a function to get the position where a string is stored in an array.


local t = table

local f = file

local c = 1


  • Store the arguments in variables and initialize the return value variable (c) to the default value 1.


for x, value in pairs(t) do

if t[x] == f then

c = x

goto e

else

c = nil

end

end

::e::

return c


  • The process is repeated as many times as there are elements in the array, and if the value stored in the array matches variable (f), then that position is set; if not, nil is set as the value of variable (c).

- API LINK -

Beginner

AZ_tableSameFileNum

Gets the storage position of the specified file in the array.

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