Changes
finish converting p.getCategoryName
local ProtectionCategory = Category:subclass('ProtectionCategory')
function ProtectionCategory:setName( name, configObj, protectionStatusObj, namespace )
--[[
-- Sets the protection category. If a category name is not provided, this
-- reason for protection, and the expiry date.
--]]
-- Get the namespace category key from the namespace number.
--]]
local properties = {
expiry = {order = 1, keypos = 5, val = expiryprotectionStatusObj:getExpiry()},
namespace = {order = 2, keypos = 3, val = nskey},
reason = {order = 3, keypos = 4, val = reasonprotectionStatusObj:getReason()}, level = {order = 4, keypos = 2, val = levelprotectionStatusObj:getLevel()}, action = {order = 5, keypos = 1, val = actionprotectionStatusObj:getAction()}
}
--[[
-- Load Apply the category order configuration for the reason specified, if any. -- The configuration is stored in the categoryOrder field of each reasonvalue -- subtable of cfgwill be a property string, e.reasonsg. If the value is a table'reason', 'namespace', then the order is the -- values specified in the tableetc. If the value is a string, then theThe property -- property corresponding to that string is tested last (i.e. it is the most
-- important, because it keeps its specified value the longest) and the
-- other properties are tested in the canonical order. If the value is ofno configuration -- any other type value is specified then the canonical order is used.
--]]
local configOrder = {}
for propertiesKey, t in pairs(properties) do
configOrder[t.order] = t
end
if categoryOrderType == 'string' categoryOrder then
local property = properties[categoryOrder]
if not property then
error(msg)
end
end
end
-- parameter.
--]]
local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(configOrder) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#inactive attemptOrder + 1] = t
end
end
-- pos field in the property table.
--]]
local cats = configObj:getConfigTable('categories')
local cat
for i = 1, 2^noActive do
local key = {}
local attempt = cats[key]
if attempt then
end
end
if cat then Category.setName(self, cat) else error( 'No category match found;' .. ' please define the category for key "all-all-all-all-all"' ) )end
end