185 |
185 |
186 int event_buffer_register(lua_State* L) { |
186 int event_buffer_register(lua_State* L) { |
187 luaL_newmetatable(L, EVENT_BUFFER_MT); |
187 luaL_newmetatable(L, EVENT_BUFFER_MT); |
188 lua_pushcfunction(L, event_buffer_gc); |
188 lua_pushcfunction(L, event_buffer_gc); |
189 lua_setfield(L, -2, "__gc"); |
189 lua_setfield(L, -2, "__gc"); |
|
190 lua_pushcfunction(L, event_buffer_get_length); |
|
191 lua_setfield(L, -2, "__len"); |
|
192 lua_pushcfunction(L, event_buffer_get_data); |
|
193 lua_setfield(L, -2, "__tostring"); |
190 lua_newtable(L); |
194 lua_newtable(L); |
191 luaL_register(L, NULL, buffer_funcs); |
195 luaL_register(L, NULL, buffer_funcs); |
192 lua_setfield(L, -2, "__index"); |
196 lua_setfield(L, -2, "__index"); |
193 lua_pop(L, 1); |
197 lua_pop(L, 1); |
194 |
198 |