aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorame <[email protected]>2023-12-24 20:42:53 -0600
committerame <[email protected]>2023-12-24 20:42:53 -0600
commitf6194080490885a0c35d9916a03cc090fd64b76e (patch)
tree71c5d25f82a74b5aea439bb0fa0b53dcde4b62a9 /src/config.c
parent697c9bdd10e845d27018d83afb7828b6c7d82605 (diff)
no newline option
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c
index 2fd4455..25919d1 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,9 +1,12 @@
#include "config.h"
+#include "io.h"
#include <string.h>
int _print_type = 0;
int _max_depth = 2;
int _start_nl_at = 3;
+int _collapse_all = 0;
+
int _file_malloc_chunk = 512;
int get_config_map(const char* key){
@@ -17,13 +20,16 @@ int l_set(lua_State* L) {
luaL_checktype(L, 1, LUA_TTABLE);
get_config_map("print_type");
lua_pushnil(L);
- for(;lua_next(L,1) != 0;){
- int ind = get_config_map(lua_tostring(L,-2));
+ for(;lua_next(L,1) != 0;){
+ int ind = get_config_map(lua_tostring(L,-2));
- if(ind != -1) {
- *config_map[ind].value = lua_tonumber(L,-1);
- }
- lua_pop(L,1);
+ if(ind != -1) {
+ *config_map[ind].value = lua_tonumber(L,-1);
+ lua_pushnumber(L, 1);
+ return 1;
}
- return 0;
+ lua_pop(L,1);
+ }
+ lua_pushnumber(L, 0);
+ return 1;
}