[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Bug: Literal strings in long format are not quite literal.
- From: Egor Skriptunoff <egor.skriptunoff@...>
- Date: Fri, 2 Nov 2012 23:23:49 +0300
On 11/2/12, Jim Studt <firstname.lastname@example.org> wrote:
> It would be nice to have a long literal that was actually literal
> for when you need precise values. e.g. you might want
> to embed a PNG, which has the offending pair in bytes 5 and 6,
> in a machine generated source file.
Use this "preprocessor" (%q format option rules!):
local png_file_content = 'A\0\r\nB' -- any binary data here
local insert_this_text_into_your_lua_source =
'local png = '..('%q'):format(png_file_content)..'\n'