Software / code / prosody
Comparison
util-src/ringbuffer.c @ 7818:54669df178c2
util-src: Make C modules assert that the Lua runtime matches what it was compiled for
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 08 Jan 2017 14:21:08 +0100 |
| parent | 7117:2b4432cc9c29 |
| child | 7827:db15e9f6d77f |
comparison
equal
deleted
inserted
replaced
| 7816:2624f4ee34a2 | 7818:54669df178c2 |
|---|---|
| 195 | 195 |
| 196 return 0; | 196 return 0; |
| 197 } | 197 } |
| 198 | 198 |
| 199 int luaopen_util_ringbuffer(lua_State* L) { | 199 int luaopen_util_ringbuffer(lua_State* L) { |
| 200 #if (LUA_VERSION_NUM > 501) | |
| 201 luaL_checkversion(L); | |
| 202 #endif | |
| 200 if(luaL_newmetatable(L, "ringbuffer_mt")) { | 203 if(luaL_newmetatable(L, "ringbuffer_mt")) { |
| 201 lua_pushcfunction(L, rb_tostring); | 204 lua_pushcfunction(L, rb_tostring); |
| 202 lua_setfield(L, -2, "__tostring"); | 205 lua_setfield(L, -2, "__tostring"); |
| 203 lua_pushcfunction(L, rb_length); | 206 lua_pushcfunction(L, rb_length); |
| 204 lua_setfield(L, -2, "__len"); | 207 lua_setfield(L, -2, "__len"); |