You can check if a specific number is there, but there doesn’t seem to be a direct way of checking if a value of any type in general is there other than iterating over it.
local hasNumber = false
for _, value in ipairs(possibleNumbers) do
if typeof(value) == "number" then
hasNumber = true
break
end
end
if hasNumber then
print("number was found inside table")
end
That wasn’t my goal, hence the reason I left the second argument blank. I wanted the script to check if a number entered by a player in a TextBox is inside the table, I wasn’t looking for one specific number.
Np I was showing an alternative method for other people in case they come across this post. Using built in methods are most probably faster than rewriting the same code by hand, as they use the internal engine’s C++ for doing the same thing that you write in Lua. Although in this case it’s probably so miniscule that it doesn’t matter. They’re also just faster to script with.