From 22bb79562a0f876c96d78f913a9ad221698354e6 Mon Sep 17 00:00:00 2001 From: ame Date: Sat, 30 Dec 2023 14:38:05 -0600 Subject: json fixes --- docs/io.md | 1 + src/config.c | 4 ++-- src/io.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/io.md b/docs/io.md index 4dba6b2..dd5aff0 100644 --- a/docs/io.md +++ b/docs/io.md @@ -19,6 +19,7 @@ llib.io.pprint({a = 5, b = {9, 9, 22}}) - start_nl_at (3) - maximum depth that will be kept in-line - collapse_all (0 | false) - skip all newlines - collapse_to_memory (1 | true) - print memory address instead of ... + ### error/warn/log/debug 'accepts a string diff --git a/src/config.c b/src/config.c index 0c8a813..4f6838f 100644 --- a/src/config.c +++ b/src/config.c @@ -32,8 +32,8 @@ int l_set(lua_State* L) { key = lua_tonumber(L, -1); } *config_map[ind].value = key; - lua_pushnumber(L, 1); - return 1; + //lua_pushnumber(L, 1); + //return 1; } lua_pop(L,1); } diff --git a/src/io.c b/src/io.c index 8250ad1..27d85cc 100644 --- a/src/io.c +++ b/src/io.c @@ -110,7 +110,7 @@ void i_pprint(lua_State* L, int indent, int skip_indent){ for(;lua_next(L,last_idx) != 0;){ if(lua_type(L,-2) == LUA_TSTRING){ if(!skip) print_indentation(indent); - printf(" %s"color_gray": "color_reset, lua_tostring(L,-2)); + printf(" '%s'"color_gray": "color_reset, lua_tostring(L,-2)); } i_pprint(L,indent+1,1); printf(","); @@ -192,7 +192,7 @@ void json_parse(lua_State* L, str* raw){ int i = 1; for(i = 1; i != raw->len - 1; i++){ topush[0] = *(raw->c + i); - if(state == normal && (topush[0] == ' ' || topush[0] == '\n')) continue; + if(state == normal && (topush[0] == ' ' || topush[0] == '\n' || topush[0] <= 10)) continue; switch(topush[0]){ case '"': -- cgit v1.2.3