✓ Accepted answer
You can use the table.find() function to look for a specified value inside a table. The function will return the index at which the value first occurs at.
The function has 3 arguments:
Table, Value, and "Init".
The table argument is the table where you want to find the specified value.
The value argument is the value you're looking for in the table.
The third "Init" argument is used to define at which point the function will start looking for the value, every index lower than init will be ignored.
Here's an example of the function in use:
local table1 = {"foo","bar",1,2,3}
print(table.find(table1,"bar"))
Output:
2
The function returns 2 since the bar component of table1 occurs at the table's second index.
Here's an example where we use the third argument, init.
local table1 = {"foo","bar",1,2,3,"bar"}
print(table.find(table1,"bar",3))
Output:
6
Now that the init value is set in place, you can see that the second index is not the output, but rather the 6th index. This is because we now defined a point to start, which is after the second index, and thus it is ignored.
2 comments
On line 5 try if Numbers ~=v then. I havent tested it though
This is just like saying instead of 1 ~= , 2 ~= 1