aboutsummaryrefslogtreecommitdiff
path: root/src/config.h
diff options
context:
space:
mode:
authoramelia squires <[email protected]>2025-04-14 14:03:08 -0500
committeramelia squires <[email protected]>2025-04-14 14:03:08 -0500
commit98d81e701a3e6c75b932ac75c872ae0e3f4d84f4 (patch)
tree48c6107656e14cfbbcbb49424fc3454de850a5db /src/config.h
parent1e5025a1631bac15e69d3ef0feff78fc1f705354 (diff)
config change, local support, overall fixesnew-config
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/config.h b/src/config.h
index 74efc15..f09af91 100644
--- a/src/config.h
+++ b/src/config.h
@@ -1,34 +1,34 @@
#include "lua.h"
+#ifndef _config_h
+#define _config_h
-extern int _print_type;
-extern int _max_depth;
-extern int _start_nl_at;
-extern int _collapse_all;
-extern int _collapse_to_memory;
-extern int _print_meta;
-
-extern int _file_malloc_chunk;
-
-struct str_to_int {
- const char* key;
- int* value;
+enum config_type {
+ c_none,
+ c_string,
+ c_int,
+ c_number,
+ //c_function,
+ //c_table
};
-static struct str_to_int config_map[] = {
- {"file_chunksize", &_file_malloc_chunk},
- {"print_type", &_print_type},
- {"max_depth", &_max_depth},
- {"collapse_all", &_collapse_all},
- {"start_nl_at", &_start_nl_at},
- {"collapse_to_memory", &_collapse_to_memory},
- {"print_meta", &_print_meta},
- {NULL,NULL}
+struct config {
+ const char* name;
+ enum config_type type;
+
+ //a single value will be valid, all other are undefined (except len which will be valid for c_string and c_function)
+ struct value {
+ char** c_string;
+ int* c_int;
+ float* c_number;
+ char** c_function;
+ //location of table in lua registery
+ int* c_table_idx;
+ //length used for c_string or c_function
+ size_t* len;
+ } value;
};
-int l_set(lua_State*);
+int i_config_metatable(lua_State*, struct config[]);
-static const luaL_Reg config_function_list [] = {
- {"set",l_set},
- {NULL,NULL}
-};
+#endif