rationalize settings into a central registry.
[apps/madmutt.git] / lib-lua / lib-lua_priv.h
index ff68378..5f69d81 100644 (file)
 #define MUTT_LIB_LUA_LIB_LUA_PRIV_H
 
 #include "lib-lua.h"
-#include "lua-token.h"
 
 #include <lua.h>
 #include <lualib.h>
 #include <lauxlib.h>
 
-#define LUA_MADMUTT          "madmutt"
+typedef enum reg_type {
+    REG_NIL,
+    REG_INT,
+    REG_BOOL,
+    REG_QUAD,
+    REG_STR,
+} reg_type;
 
+typedef struct reg_entry {
+    int type;
+    union {
+        int i;
+        void *p;
+        char *s;
+    };
+} reg_entry;
+
+static inline void reg_entry_wipe(reg_entry *e) {
+    switch (e->type) {
+      case REG_STR:
+        p_delete(&e->s);
+        break;
+      default:
+        break;
+    }
+    e->type = REG_NIL;
+}
+
+#define LUA_MADMUTT  "madmutt"
 int luaopen_madmutt(lua_State *L);
 
 #endif