lm.c
changeset 0 84fdfb0344c9
child 6 90073cbb535d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lm.c	Sun Feb 01 21:28:57 2009 +0200
@@ -0,0 +1,37 @@
+
+#include <lua.h>
+
+#include "lm_types.h"
+#include "lm_message_node.h"
+#include "lm_message.h"
+#include "lm_message_handler.h"
+#include "lm_proxy.h"
+#include "lm_ssl.h"
+#include "lm_connection.h"
+
+int luaopen_loudmouth (lua_State *L)
+{
+	lua_pushstring (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_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");
+
+	luaopen_lm_message_node (L);
+	luaopen_lm_message (L);
+	luaopen_lm_message_handler (L);
+	luaopen_lm_proxy (L);
+	luaopen_lm_ssl (L);
+	luaopen_lm_connection (L);
+	lua_pop (L, 6);
+
+	return 1;
+}
+