stringsqliteluaescapingcoronasdk

Escape characters in a text in Lua


In my SQlite3 database, I have a following VARCHAR data:

data = 'Kim okurdu kim yazardı \n Bu düğümü kim çözerdi \n Koyun kurt ile gezerdi \n Fikir başka başk\'olmasa'

And I try to display this text with:

local myText = display.newEmbossedText(data, globals.W/2,globals.H/2,300,300, native.systemFont, 16, { 1, 1, 1 } )

However, escape characters are not detected. How can I fix that?


Solution

  • I solved my problem with following line, thanks to Lerg from Corona community:

    data:gsub([[\n]], '\n')