Here is your code written to be Lua array friendly:
valueToCheckFor = 35
sampleArray = {}
for i=30, 49 do
-- add to end of array
sampleArray[#sampleArray+1] = i + 1
print(i+1)
end
-- check each value in array
for k = 1, #sampleArray do
if valueToCheckFor == sampleArray[k] then
print(valueToCheckFor .. " is in the array.")
else
print(valueToCheckFor .. " is not in the array.")
end
end