1
local t = "Hello, World"
local v = "Hello World"
I wonder how to check if a string contains commas...
1
local t = "Hello, World"
local v = "Hello World"
I wonder how to check if a string contains commas...
3
You can use the function find
str = "Hello, World"
if string.find(str, ",") then
  print ("Encontrou virgula.")
else
  print ("Não encontrou virgula.")
end
If the search pattern is found the function returns the position (start and end) within the string where it was found.
> = string.find("Hello Lua user", "Lua")
7       9
> = string.find("Hello Lua user", "banana")
nil
							Browser other questions tagged lua
You are not signed in. Login or sign up in order to post.
That’s right, I didn’t remember this string.find function! Thanks
– vodka