From e5323b0c7fac6ae251228473407591139dcd0e58 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 6 May 2015 19:02:07 +0100 Subject: moduleapi: Minor variable renaming to avoid clashes with the 'type' function --- core/moduleapi.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'core') diff --git a/core/moduleapi.lua b/core/moduleapi.lua index c7fadc27..fbb131ec 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -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 -- cgit v1.2.3