--- a/lm.c Fri Mar 27 09:43:25 2009 +0200
+++ b/lm.c Fri Mar 27 09:43:41 2009 +0200
@@ -1,6 +1,7 @@
#include <lua.h>
+#include "config.h"
#include "lm_types.h"
#include "lm_message_node.h"
#include "lm_message.h"
@@ -20,26 +21,35 @@
int luaopen_loudmouth (lua_State *L)
{
- lua_pushstring (L, LLM_OBJREGISTRY); // 1 registry key
+ lua_pushconststring (L, LLM_OBJREGISTRY); // 1 registry key
lua_newtable (L); // 2 registry value (table)
lua_createtable (L, 0, 1); // 3 metatable
- lua_pushstring (L, "__mode"); // 4 metatable key
- lua_pushstring (L, "v"); // 5 metatable value
+ lua_pushconststring (L, "__mode"); // 4 metatable key
+ lua_pushconststring (L, "v"); // 5 metatable value
lua_settable (L, -3); // 3 metatable
lua_setmetatable (L, -2); // 2 registry value
lua_rawset (L, LUA_REGISTRYINDEX); // 0
lua_createtable (L, 6, 0);
- lua_pushvalue (L, -1);
- lua_setglobal (L, "lm");
+ lua_pushconststring (L, "message_node");
luaopen_lm_message_node (L);
+ lua_settable (L, -3);
+ lua_pushconststring (L, "message");
luaopen_lm_message (L);
+ lua_settable (L, -3);
+ lua_pushconststring (L, "message_handler");
luaopen_lm_message_handler (L);
+ lua_settable (L, -3);
+ lua_pushconststring (L, "proxy");
luaopen_lm_proxy (L);
+ lua_settable (L, -3);
+ lua_pushconststring (L, "ssl");
luaopen_lm_ssl (L);
+ lua_settable (L, -3);
+ lua_pushconststring (L, "connection");
luaopen_lm_connection (L);
- lua_pop (L, 6);
+ lua_settable (L, -3);
return 1;
}