lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> If I %q-format a string with \r in it, the \r gets entered into the
> string literally and the Lua interpreter barfs reading it back,
> contrary to the documentation.  This is Lua5.1 (LuaJIT 1.1.0).
> Bug or my problem?

This is a bug, sorry. Here is a fix:

***************
*** 703,708 ****
--- 703,712 ----
          luaL_addchar(b, *s);
          break;
        }
+       case '\r': {
+         luaL_addlstring(b, "\\r", 2);
+         break;
+       }
        case '\0': {
          luaL_addlstring(b, "\\000", 4);
          break;