pub fn escape_string(text: &str) -> StringExpand description
Escape a string for a Lua double-quoted literal.
Not crate::writer::escape_string, and the difference is a defect
that form would produce here. A Lua decimal escape reads up to
three digits (Lua 5.4 reference ยง3.1), so \0 followed by the
character 1 is \01, which is the octet 1 and not two octets. Every
escape written here is therefore three digits wide, and the ambiguity
cannot arise.
Everything outside the control range goes through unchanged, the
non-ASCII included: a Lua string is a sequence of octets with no
encoding of its own, so the UTF-8 of a wstring holder is written as
itself.