[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: embedding zeroes
- From: Rebel Neurofog <rebelneurofog@...>
- Date: Mon, 19 Dec 2011 18:51:55 +0300
On Mon, Dec 19, 2011 at 7:43 PM, Patrick Rapin <firstname.lastname@example.org> wrote:
>> I'd like to ask whether this quotation improvement is guaranteed or
>> not to work in Lua:
>> output:write ((string.gsub (string.format ("bootstrap_image = %q",
>> binary), "\\000", "\0")))
> To my knowledge, yes.
> But I don't get the point to use the %q format modifier along with
> that substitution.
> If you really want the shortest possible result, you can just use a
> long string like in:
> output:write (string.format ("bootstrap_image = [=[%s]=]", binary))
> After having verified that neither [=[ nor ]=] appear in binary (or
> test dynamically the number of = signs to use).
It doesn't work at least due to newline mangling.