about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-07 08:22:37 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-03-07 08:22:37 -0800
commit503ad706fbe7400f197f92dc1d895fd2f3db7cb8 (patch)
tree0f21d95b47a39de0d7fbe28eba2623e0c15db40e /src
parentd388cc1f229b74c181e8a7c466396ff02202c8b1 (diff)
downloadteliva-503ad706fbe7400f197f92dc1d895fd2f3db7cb8.tar.gz
zet.tlv: switch file reads to new API
In the process I found a couple of bugs in parsing JSON string escapes.
Diffstat (limited to 'src')
-rw-r--r--src/jsonf.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jsonf.lua b/src/jsonf.lua
index ecf1eea..25e0c6e 100644
--- a/src/jsonf.lua
+++ b/src/jsonf.lua
@@ -127,7 +127,7 @@ local function parse_string(infile, firstc)
 
     if x < 32 then
       error("control character in string")
-    elseif c == '\\' then
+    elseif chr == '\\' then
       local c = infile:recv()
       if c == nil then break end
       if c == "u" then
@@ -152,7 +152,7 @@ local function parse_string(infile, firstc)
         if not escape_chars[c] then
           error("invalid escape char '" .. c .. "' in string")
         end
-        table.insert(escape_char_map_inv[c])
+        table.insert(res, escape_char_map_inv[c])
       end
     elseif chr == '"' then
       return table.concat(res), infile:recv()