moduleapi: Minor variable renaming to avoid clashes with the 'type' function
authorMatthew Wild <mwild1@gmail.com>
Wed, 6 May 2015 18:02:07 +0000 (19:02 +0100)
committerMatthew Wild <mwild1@gmail.com>
Wed, 6 May 2015 18:02:07 +0000 (19:02 +0100)
core/moduleapi.lua

index c7fadc27fe117281cc5039df13c146e1f62a6f30..fbb131ecc701084dbd52a19d1b2fca7a3c199762 100644 (file)
@@ -63,8 +63,8 @@ end
 function api:add_feature(xmlns)
        self:add_item("feature", xmlns);
 end
-function api:add_identity(category, type, name)
-       self:add_item("identity", {category = category, type = type, name = name});
+function api:add_identity(category, identity_type, name)
+       self:add_item("identity", {category = category, type = identity_type, name = name});
 end
 function api:add_extension(data)
        self:add_item("extension", data);
@@ -75,9 +75,9 @@ function api:has_feature(xmlns)
        end
        return false;
 end
-function api:has_identity(category, type, name)
+function api:has_identity(category, identity_type, name)
        for _, id in ipairs(self:get_host_items("identity")) do
-               if id.category == category and id.type == type and id.name == name then
+               if id.category == category and id.type == identity_type and id.name == name then
                        return true;
                end
        end
@@ -329,11 +329,11 @@ function api:get_host_items(key)
        return result;
 end
 
-function api:handle_items(type, added_cb, removed_cb, existing)
-       self:hook("item-added/"..type, added_cb);
-       self:hook("item-removed/"..type, removed_cb);
+function api:handle_items(item_type, added_cb, removed_cb, existing)
+       self:hook("item-added/"..item_type, added_cb);
+       self:hook("item-removed/"..item_type, removed_cb);
        if existing ~= false then
-               for _, item in ipairs(self:get_host_items(type)) do
+               for _, item in ipairs(self:get_host_items(item_type)) do
                        added_cb({ item = item });
                end
        end
@@ -389,19 +389,19 @@ function api:load_resource(path, mode)
        return io.open(path, mode);
 end
 
-function api:open_store(name, type)
-       return require"core.storagemanager".open(self.host, name or self.name, type);
+function api:open_store(name, store_type)
+       return require"core.storagemanager".open(self.host, name or self.name, store_type);
 end
 
-function api:measure(name, type)
-       return measure(type, "/"..self.host.."/mod_"..self.name.."/"..name);
+function api:measure(name, stat_type)
+       return measure(stat_type, "/"..self.host.."/mod_"..self.name.."/"..name);
 end
 
 function api:measure_object_event(events_object, event_name, stat_name)
        local m = self:measure(stat_name or event_name, "duration");
-       local function handler(handlers, event_name, event_data)
+       local function handler(handlers, _event_name, _event_data)
                local finished = m();
-               local ret = handlers(event_name, event_data);
+               local ret = handlers(_event_name, _event_data);
                finished();
                return ret;
        end