Add base:method() to return string identifying the current libevent backend in use

Mon, 07 Dec 2009 21:44:00 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 07 Dec 2009 21:44:00 +0000
changeset 68
9e119bf833ae
parent 67
7fd8dbfb54d5
child 69
da7e8688a2b5

Add base:method() to return string identifying the current libevent backend in use

src/luaevent.c file | annotate | diff | comparison | revisions
--- a/src/luaevent.c	Mon Dec 07 21:36:31 2009 +0000
+++ b/src/luaevent.c	Mon Dec 07 21:44:00 2009 +0000
@@ -99,10 +99,17 @@
 	return 1;
 }
 
+static int luaevent_method(lua_State* L) {
+	le_base *base = event_base_get(L, 1);
+	lua_pushstring(L, event_base_get_method(base->base));
+	return 1;
+}
+
 static luaL_Reg base_funcs[] = {
 	{ "addevent", luaevent_addevent },
 	{ "loop", luaevent_loop },
 	{ "loopexit", luaevent_loopexit },
+	{ "method", luaevent_method },
 	{ NULL, NULL }
 };
 

mercurial