Posted 25 September 2013 - 07:30 PM
I'm making a table that holds names and I want to see if the table has a certain name in it
function isin(tab,look)
for i=1,#tab do
if tab[i] == look then return i end
end
return nil
end
Worked exactly as I needed it to the first way thanksIs your table indexed numerically?
if then
tab – Your table
look – sting you are looking forfunction isin(tab,look) for i=1,#tab do if tab[i] == look then return i end end return nil end
This will return number where look is in table or nil if its not in table
EDIT : Or change "return i" into "return true" and "return nil" into "return false" for true false info.