[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: unescape lua string (opposite of %q)
- From: Jonathan Castello <twisolar@...>
- Date: Fri, 4 Jun 2010 23:18:28 -0700
On Fri, Jun 4, 2010 at 11:14 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> local input = [[line1\nline2]]
>> local output = loadstring("return \"" .. input .. "\"")()
>
> Does not work if input contains double quotes.
>
----
local input = [["line1"\nline2]]
input = input:gsub([["]], [[\"]])
local output = loadstring("return \"" .. input .. "\"")()
----
~Jonathan