[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- 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 <jim@studt.net> 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'
:-)