MINOR: hlua_fcn: add Server.tracking()
This function returns the currently tracked server, if any.
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index 61eb580..931b609 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -1410,6 +1410,26 @@
return 0;
}
+/* returns the tracked server, if any */
+int hlua_server_tracking(lua_State *L)
+{
+ struct server *sv;
+ struct server *tracked;
+
+ sv = hlua_check_server(L, 1);
+ if (sv == NULL) {
+ return 0;
+ }
+
+ tracked = sv->track;
+ if (tracked == NULL)
+ lua_pushnil(L);
+ else
+ hlua_fcn_new_server(L, tracked);
+
+ return 1;
+}
+
/* hlua_event_sub wrapper for per-server subscription:
*
* hlua_event_sub() is called with sv->e_subs subscription list and
@@ -1472,6 +1492,7 @@
hlua_class_function(L, "agent_disable", hlua_server_agent_disable);
hlua_class_function(L, "agent_force_up", hlua_server_agent_force_up);
hlua_class_function(L, "agent_force_down", hlua_server_agent_force_down);
+ hlua_class_function(L, "tracking", hlua_server_tracking);
hlua_class_function(L, "event_sub", hlua_server_event_sub);
return 1;