Feche1320 Posted May 24, 2011 Share Posted May 24, 2011 function isInTable(table, arg) local result = false for i = 1, #table do if table[i] == arg then result = true break end end return result end If I insert in the table "asd", and then use isInTable(the table, "asd") it will return false always, why? (I don't see any errors on code) Thanks Link to comment
karlis Posted May 24, 2011 Share Posted May 24, 2011 seems it should work, however this is more compact function isInTable(tbl,arg) for _,v in pairs(tbl) do if arg==v then return true end end return false end Link to comment
Feche1320 Posted May 25, 2011 Author Share Posted May 25, 2011 I changed == to string.find and works.. pretty rare.. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now