use new lua userdata api

This commit is contained in:
Cloud Wu
2020-10-10 19:19:33 +08:00
parent 623d8182eb
commit a87b039c6d
10 changed files with 26 additions and 26 deletions

View File

@@ -53,7 +53,7 @@ lfreepool(lua_State *L) {
static int
lnewpool(lua_State *L, int sz) {
struct buffer_node * pool = lua_newuserdata(L, sizeof(struct buffer_node) * sz);
struct buffer_node * pool = lua_newuserdatauv(L, sizeof(struct buffer_node) * sz, 0);
int i;
for (i=0;i<sz;i++) {
pool[i].msg = NULL;
@@ -71,7 +71,7 @@ lnewpool(lua_State *L, int sz) {
static int
lnewbuffer(lua_State *L) {
struct socket_buffer * sb = lua_newuserdata(L, sizeof(*sb));
struct socket_buffer * sb = lua_newuserdatauv(L, sizeof(*sb), 0);
sb->size = 0;
sb->offset = 0;
sb->head = NULL;