Comparison

util/pubsub.lua @ 3931:6daed692264f

util.pubsub: get_items(): When requesting a specific item, use the id as a key to mirror the multiple-item case
author Matthew Wild <mwild1@gmail.com>
date Wed, 22 Dec 2010 02:13:26 +0000
parent 3928:4dfb345e33ec
child 3934:4bd994df7296
comparison
equal deleted inserted replaced
3930:46d9cf613bb1 3931:6daed692264f
225 local node_obj = self.nodes[node]; 225 local node_obj = self.nodes[node];
226 if not node_obj then 226 if not node_obj then
227 return false, "item-not-found"; 227 return false, "item-not-found";
228 end 228 end
229 if id then -- Restrict results to a single specific item 229 if id then -- Restrict results to a single specific item
230 return true, { node_obj.data[id] }; 230 return true, { [id] = node_obj.data[id] };
231 else 231 else
232 return true, node_obj.data; 232 return true, node_obj.data;
233 end 233 end
234 end 234 end
235 235