Turbesz Posted November 18, 2020 Share Posted November 18, 2020 I tried this method, but does not work: local tabla = {"Valami", "ASdasd", "Teszt", "Proba"} function teszt() local talalat = table.find(tabla,"Va") outputChatBox(talalat) end addCommandHandler("test",teszt) function table.find(tabl,word) if type(tabl) ~= "table" or word == nil then return false else local ret = false for k,v in pairs(tabl) do if v == word then return k end end end end Link to comment
Moderators Patrick Posted November 18, 2020 Moderators Share Posted November 18, 2020 It works, but "Va" is not in the list. Link to comment
Tekken Posted November 18, 2020 Share Posted November 18, 2020 Try this function table.find(tabl,word) if type(tabl) ~= "table" or word == nil then return false else local ret = false for k,v in pairs(tabl) do if string.find(v, word) then return k end end end end 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