From: Pierre Habouzit Date: Sun, 11 Mar 2007 01:55:43 +0000 (+0100) Subject: now this is slightly better. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=84dadd88f9d900c76451ac97b74c9187fab0dd09;p=apps%2Fmadmutt.git now this is slightly better. Signed-off-by: Pierre Habouzit --- diff --git a/lib-lua/runtime.c b/lib-lua/runtime.c index f36af4d..becd6de 100644 --- a/lib-lua/runtime.c +++ b/lib-lua/runtime.c @@ -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); } }