From 84dadd88f9d900c76451ac97b74c9187fab0dd09 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sun, 11 Mar 2007 02:55:43 +0100 Subject: [PATCH] now this is slightly better. Signed-off-by: Pierre Habouzit --- lib-lua/runtime.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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); } } -- 2.20.1