now this is slightly better.
[apps/madmutt.git] / lib-lua / runtime.c
index f36af4d..becd6de 100644 (file)
@@ -85,7 +85,6 @@ static const struct {
      ** header chaching's database backend.\fP
      */
 #endif
-    { NULL,         NULL }
 };
 
 void mlua_initialize(void)
@@ -101,12 +100,8 @@ void mlua_initialize(void)
     luaL_register(L, "madmutt", madmutt_module_funcs);
 
     for (i = 0; i < countof(madmutt_module_vars); i++) {
-        char buffer[STRING];
-
-        snprintf(buffer, sizeof(buffer), "madmutt.%s = \"%s\";",
-                 madmutt_module_vars[i].key,
-                 madmutt_module_vars[i].value);
-        (void)luaL_dostring(L, buffer);
+        lua_pushstring(L, madmutt_module_vars[i].value);
+        lua_setfield(L, -2, madmutt_module_vars[i].key);
     }
 }