From 748dba485920dca572c0703d84e7335503485253 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Fri, 21 Mar 2025 23:00:59 +0100 Subject: [PATCH] MINOR: hlua_fcn: register queue class using hlua_register_metatable() Most lua classes are registered by leveraging the hlua_register_metatable() helper. Let's use that for the Queue class as well for consitency. --- include/haproxy/hlua-t.h | 1 + src/hlua_fcn.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/haproxy/hlua-t.h b/include/haproxy/hlua-t.h index 277586304..ed2cfad75 100644 --- a/include/haproxy/hlua-t.h +++ b/include/haproxy/hlua-t.h @@ -60,6 +60,7 @@ #define CLASS_CERTCACHE "CertCache" #define CLASS_PROXY_LIST "ProxyList" #define CLASS_SERVER_LIST "ServerList" +#define CLASS_QUEUE "Queue" struct stream; diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index dee1d4216..6d3d6696d 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -728,7 +728,7 @@ static void hlua_queue_init(lua_State *L) hlua_class_function(L, "__gc", hlua_queue_gc); - class_queue_ref = luaL_ref(L, LUA_REGISTRYINDEX); + class_queue_ref = hlua_register_metatable(L, CLASS_QUEUE); } int hlua_fcn_new_stktable(lua_State *L, struct stktable *tbl)