aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Harning Jr <harningt@gmail.com>2007-11-25 17:41:48 -0500
committerThomas Harning Jr <harningt@gmail.com>2007-11-25 17:41:48 -0500
commitf7c5f12e4cf840b59631f4fe12633b217ae7155f (patch)
tree0fd7b62b045c9921dc46369c41dfc34e09321213 /src
parent9a0e90fd36e40819abe6f82085ee867293469687 (diff)
downloadluaevent-prosody-f7c5f12e4cf840b59631f4fe12633b217ae7155f.tar.gz
luaevent-prosody-f7c5f12e4cf840b59631f4fe12633b217ae7155f.zip
buffer_event learned get_read/get_write buffer accessors
Diffstat (limited to 'src')
-rw-r--r--src/buffer_event.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/buffer_event.c b/src/buffer_event.c
index 12aa3ec..2f5dbcd 100644
--- a/src/buffer_event.c
+++ b/src/buffer_event.c
@@ -127,7 +127,23 @@ static int buffer_event_gc(lua_State* L) {
return 0;
}
+static int buffer_event_get_read(lua_State* L) {
+ (void)buffer_event_get(L, 1);
+ lua_getfenv(L, 1);
+ lua_rawgeti(L, -1, READ_BUFFER_LOCATION);
+ return 1;
+}
+
+static int buffer_event_get_write(lua_State* L) {
+ (void)buffer_event_get(L, 1);
+ lua_getfenv(L, 1);
+ lua_rawgeti(L, -1, WRITE_BUFFER_LOCATION);
+ return 1;
+}
+
static luaL_Reg buffer_event_funcs[] = {
+ {"get_read", buffer_event_get_read},
+ {"get_write", buffer_event_get_write},
{NULL, NULL}
};