diff options
author | Thomas Harning Jr <harningt@gmail.com> | 2007-11-25 17:41:48 -0500 |
---|---|---|
committer | Thomas Harning Jr <harningt@gmail.com> | 2007-11-25 17:41:48 -0500 |
commit | f7c5f12e4cf840b59631f4fe12633b217ae7155f (patch) | |
tree | 0fd7b62b045c9921dc46369c41dfc34e09321213 /src | |
parent | 9a0e90fd36e40819abe6f82085ee867293469687 (diff) | |
download | luaevent-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.c | 16 |
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} }; |