spc476 / CBOR

The most comprehensive CBOR module in the Lua universe.
GNU Lesser General Public License v3.0
22 stars 3 forks source link

org.conman.table dependency missing #4

Closed daurnimator closed 5 years ago

daurnimator commented 5 years ago

Trying to use the cbormisc module, it fails to load the library due to the org.conman.table module not being installed. I can't seem to find it in any of your existing lua rocks?

spc476 commented 5 years ago

You are right. Until I can straighten this out, the module is available on Github. The function called escapes any control and non-ASCII characters so it's safe to print.

spc476 commented 5 years ago

I removed the use of the module not available via LuaRocks.

daurnimator commented 5 years ago

Note that string.format's %q does what safestring does in 5.3.

spc476 commented 5 years ago

Not quite---the safestring() I wrote will escape non-ASCII characters---that is, above 128. So a string like "\0\4\tone two three\u{0345}" will print as "\000\004\tone two three\205\133". Lua 5.1 (which the CBOR module supports) doesn't handle it the same way (it fails to escape the \4 and the \t characters).

daurnimator commented 5 years ago

Ah. I didn't realise you wanted to escape > 128. Lua 5.3 brings the improvement of 5.1 that control characters (such as \4 and \t) are escaped by%q`