- API -
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 Boolean
end
t = {10,20,30,40,50}
a = tableSameFileBool(t,30)
Msg(a)
- API Detail-
No preparation required
- SCRIPT -
dofile(reaper.AZ_GetLuaInitPath())
function tableSameFileBool(table,file)
Define a function to check if a string is stored in an array.
local tableL = table
local fileL = file
local BoolL = false
Store the arguments in variables and initialize the return value variable (BoolL) to the default value false.
for x, value in pairs(tableL) do
if tableL[x] == fileL then
BoolL = true
goto e
else
BoolL = false
end
end
::e::
return Boolean
Repeat the process for the number of elements in the array, and set the value of the variable BoolL to the value stored in the array.
If it matches the variable (fileL), it is true; if not, it is false.
If there is a match, the loop ends.