event_buffer learned to manage '#' and the __tostring metafield

Fri, 07 Sep 2007 00:20:10 -0400

author
Thomas Harning Jr <harningt@gmail.com>
date
Fri, 07 Sep 2007 00:20:10 -0400
changeset 33
0d750f302d66
parent 32
22976b4e5ffd
child 34
64a79d8ee224

event_buffer learned to manage '#' and the __tostring metafield

src/event_buffer.c file | annotate | diff | comparison | revisions
--- a/src/event_buffer.c	Fri Sep 07 00:17:08 2007 -0400
+++ b/src/event_buffer.c	Fri Sep 07 00:20:10 2007 -0400
@@ -187,6 +187,10 @@
 	luaL_newmetatable(L, EVENT_BUFFER_MT);
 	lua_pushcfunction(L, event_buffer_gc);
 	lua_setfield(L, -2, "__gc");
+	lua_pushcfunction(L, event_buffer_get_length);
+	lua_setfield(L, -2, "__len");
+	lua_pushcfunction(L, event_buffer_get_data);
+	lua_setfield(L, -2, "__tostring");
 	lua_newtable(L);
 	luaL_register(L, NULL, buffer_funcs);
 	lua_setfield(L, -2, "__index");

mercurial