xXGhostXx Posted October 21, 2019 Posted October 21, 2019 Hi guys. I try to use string.find with table. characters = { ["a"] = true, ["b"] = true, ["c"] = true, } function test (username) if string.find(username, characters[username]) then else outputChatBox("This is invalid character!",source) end end What is my problem ?
Rockyz Posted October 21, 2019 Posted October 21, 2019 Here you go: characters = {"a", "b", "c"} function test(username) if string.find(username, "["..table.concat(characters, "").."]") then end end
xXGhostXx Posted October 21, 2019 Author Posted October 21, 2019 (edited) 1 hour ago, xiRocKyz said: Here you go: characters = {"a", "b", "c"} function test(username) if string.find(username, "["..table.concat(characters, "").."]") then end end Working because i want add allowing characters in table. Edited October 21, 2019 by xXGhostXx
xXGhostXx Posted October 23, 2019 Author Posted October 23, 2019 On 21/10/2019 at 20:57, xXGhostXx said: Working because i want add allowing characters in table. Help me
Rockyz Posted October 23, 2019 Posted October 23, 2019 2 hours ago, xXGhostXx said: Help me Could you explain what is the problem ?
xXGhostXx Posted October 23, 2019 Author Posted October 23, 2019 2 hours ago, xiRocKyz said: Could you explain what is the problem ? Your code is working but i want add allowing characters in table.
xXGhostXx Posted October 27, 2019 Author Posted October 27, 2019 On 23/10/2019 at 20:51, xiRocKyz said: Could you explain what is the problem ? help!
Moderators IIYAMA Posted October 27, 2019 Moderators Posted October 27, 2019 5 minutes ago, xXGhostXx said: help! Even after you received my warning, you are still continuing with bumping 2x. The content of those messages are not useful in anyway and very annoying for everybody, therefore I consider them as spam. https://forum.multitheftauto.com/topic/120659-help-stringfind/?do=findComment&comment=966942 https://forum.multitheftauto.com/topic/120659-help-stringfind/?do=findComment&comment=967139 Locked Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts