MINOR: hlua_fcn: add Server.get_trackers()

This function returns an array of servers who are currently tracking
the server.
diff --git a/doc/lua-api/index.rst b/doc/lua-api/index.rst
index 4055ac2..042f231 100644
--- a/doc/lua-api/index.rst
+++ b/doc/lua-api/index.rst
@@ -1346,6 +1346,15 @@
   :returns: A :ref:`server_class` which indicates the tracked server or nil if
    the server doesn't track another one.
 
+.. js:function:: Server.get_trackers(sv)
+
+  Check if the current server is being tracked by other servers.
+
+  :param class_server sv: A :ref:`server_class` which indicates the manipulated
+   server.
+  :returns: An array of :ref:`server_class` which indicates the tracking
+   servers (might be empty)
+
 .. js:function:: Server.event_sub(sv, event_types, func)
 
   Register a function that will be called on specific server events.
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index 931b609..308e1d8 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -1430,6 +1430,30 @@
 	return 1;
 }
 
+/* returns an array of servers tracking the current server */
+int hlua_server_get_trackers(lua_State *L)
+{
+	struct server *sv;
+	struct server *cur_tracker;
+	int index;
+
+	sv = hlua_check_server(L, 1);
+	if (sv == NULL) {
+		return 0;
+	}
+
+	lua_newtable(L);
+	cur_tracker = sv->trackers;
+	for (index = 1; cur_tracker; cur_tracker = cur_tracker->tracknext, index++) {
+		if (!lua_checkstack(L, 5))
+			luaL_error(L, "Lua out of memory error.");
+		hlua_fcn_new_server(L, cur_tracker);
+		/* array index starts at 1 in Lua */
+		lua_rawseti(L, -2, index);
+	}
+	return 1;
+}
+
 /* hlua_event_sub wrapper for per-server subscription:
  *
  * hlua_event_sub() is called with sv->e_subs subscription list and
@@ -1493,6 +1517,7 @@
 	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, "get_trackers", hlua_server_get_trackers);
 	hlua_class_function(L, "event_sub", hlua_server_event_sub);
 
 	return 1;