diff options
| author | amelia squires <[email protected]> | 2025-04-14 14:03:08 -0500 |
|---|---|---|
| committer | amelia squires <[email protected]> | 2025-04-14 14:03:08 -0500 |
| commit | dc7e4527e88ed0c59e17c0ff04c01e1c92136e42 (patch) | |
| tree | 48c6107656e14cfbbcbb49424fc3454de850a5db /src/config.h | |
| parent | 9c3eea30aeb3c13b6df2288fbd086756a217a04b (diff) | |
config change, local support, overall fixes
Diffstat (limited to 'src/config.h')
| -rw-r--r-- | src/config.h | 52 |
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 |
