function FindSpot(table, value)
local index = -1
for i, v in pairs(table) do
if table[i] == value then
return i
end
end
return index
end
local test_array = { 5, 7, 1, 10, 9, 24, 25 }
local value = math.random(1, 25)
--[[
print(FindSpot(test_array, value))
print(value)
--]]
if FindSpot(test_array, value) ~= -1 then
print("Index in array:", FindSpot(test_array, value))
else
print("Unidentified value in data table array, value:", value)
end
To embed this project on your website, copy the following code and paste it into your website's HTML: