Diff

util/pubsub.lua @ 7703:74e755674e0f

util.pubsub: Rename loop variable to avoid name clash [luacheck]
author Kim Alvefur <zash@zash.se>
date Tue, 18 Oct 2016 15:29:23 +0200
parent 7696:1c410b4f3a58
child 7704:5022e6181193
child 7726:29c20eefa306
line wrap: on
line diff
--- a/util/pubsub.lua	Tue Oct 18 15:19:01 2016 +0200
+++ b/util/pubsub.lua	Tue Oct 18 15:29:23 2016 +0200
@@ -371,13 +371,13 @@
 	-- a get_subscription() call for each node.
 	local ret = {};
 	if subs then
-		for jid, subscribed_nodes in pairs(subs) do
+		for subscribed_jid, subscribed_nodes in pairs(subs) do
 			if node then -- Return only subscriptions to this node
 				if subscribed_nodes[node] then
 					ret[#ret+1] = {
 						node = node;
-						jid = jid;
-						subscription = node_obj.subscribers[jid];
+						jid = subscribed_jid;
+						subscription = node_obj.subscribers[subscribed_jid];
 					};
 				end
 			else -- Return subscriptions to all nodes
@@ -385,8 +385,8 @@
 				for subscribed_node in pairs(subscribed_nodes) do
 					ret[#ret+1] = {
 						node = subscribed_node;
-						jid = jid;
-						subscription = nodes[subscribed_node].subscribers[jid];
+						jid = subscribed_jid;
+						subscription = nodes[subscribed_node].subscribers[subscribed_jid];
 					};
 				end
 			end