188 posts
Location
Germany
Posted 28 November 2016 - 07:33 PM
If I write string.find("test()","("), it give me the error "unfinished capture". Other Chars work. what can I do?
1583 posts
Location
Germany
Posted 28 November 2016 - 07:43 PM
Because brackets are a special character in patterns you have to escape them.
("test()"):find "%("
122 posts
Location
France
Posted 04 December 2016 - 01:49 PM
…
Please do not forgot the brackets, because this is correct, but pretty dirty:
("test()"):find("%(");
or
string.find("test()", "%(");
Edited on 04 December 2016 - 12:51 PM
1583 posts
Location
Germany
Posted 04 December 2016 - 04:25 PM
…
Please do not forgot the brackets, because this is correct, but pretty dirty:
("test()"):find("%(");
or
string.find("test()", "%(");
That's "normal" Lua syntax. I don't see a reason why you should add brackets if you don't have to; You save time and space. In contrast, your code is "dirty": You are using semicola even though they have no "special" meaning in Lua. They are just there to comfort those who come from languages enforcing them so their habits won't break their code.