now this is slightly better.
authorPierre Habouzit <madcoder@debian.org>
Sun, 11 Mar 2007 01:55:43 +0000 (02:55 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 11 Mar 2007 01:55:43 +0000 (02:55 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
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);
     }
 }