stylish updates.
[apps/madmutt.git] / lib-lua / runtime.c
index 8788ed5..0fb777c 100644 (file)
@@ -21,6 +21,7 @@
 #include "lib-lua_priv.h"
 
 static lua_State *L;
 #include "lib-lua_priv.h"
 
 static lua_State *L;
+static reg_entry registry[LTK_count];
 
 static const luaL_Reg lualibs[] = {
     {"",              luaopen_base},
 
 static const luaL_Reg lualibs[] = {
     {"",              luaopen_base},
@@ -66,3 +67,30 @@ int mlua_wrap(void (*errfun)(const char *fmt, ...), int status)
     return status;
 }
 
     return status;
 }
 
+const char *mlua_reggets(int tk)
+{
+    if (registry[tk].type != REG_STR)
+        return NULL;
+    return registry[tk].s;
+}
+
+int mlua_reggeti(int tk)
+{
+    if (registry[tk].type != REG_INT)
+        return -1;
+    return registry[tk].i;
+}
+
+void mlua_regsets(int tk, const char *s)
+{
+    reg_entry_wipe(registry + tk);
+    registry[tk].type = REG_STR;
+    registry[tk].s    = m_strdup(s);
+}
+
+void mlua_regseti(int tk, int i)
+{
+    reg_entry_wipe(registry + tk);
+    registry[tk].type = REG_INT;
+    registry[tk].i    = i;
+}