Я расскажу некоторые вещи в дополнение к тому, что @Darius сказал выше
Когда вы попытались добавить знак кавычки в строку, интерпретатор lua запутался и сломал вашу строку после следующего знака кавычки не доходя до конца строки. Вот причина ошибки.
Попробуйте понять ее с помощью следующего кода
str = "Hello I"m somebody" -- here the interpreter will think str equals to "Hello I" at first, and then it will find some random characters after which may make it confused (as m somebody is neither a variable nor a keyword)"
-- you can also see the way it got confused by looking at the highlighted code
--What you can do to avoid this is escaping the quotes
str = "Hello I\"m somebody" -- here the interpreter will treat \" as a raw character (") and parse the rest.
Вы также можете использовать escape-символ () с другими, такими как \'
, \"
, \[
, \n
(символ новой строки), \t
(вкладка) и т. Д.