The correct way to call the prompt function in the way you desire is as such:
prompt(tostring(io.read()))
What you are doing is redeclaring prompt
to be the value of the input, rather than a function.
Also, the way you are checking if the input value exists in the table is incorrect.
if input == number then
This would not work in any (or at least the majority) of programming languages. What you are doing here is comparing a string to a table. Yes, you are comparing and not checking whether the table contains the string. Basically you are telling the code: is my string the equivalent of this table?.
In order to find out whether the string exists in the table, you would need to loop the table and compare each value in the table individually. Below is an article that speaks of this:
Search for an item in a Lua list
Here is what your code would look like:
local number = {"1", "2", "3"}
function prompt(input)
for index, item in ipairs(number) do
if input == item then
-- If we find a match print and return
return print("Yes your number is here")
end
end
-- No match. We know this as the above code would have returned
-- if a match had been found and thus never reach this part of the code.
return print("Nope, your number not here")
end
prompt(tostring(io.read()))