Module:Sandbox/Skkias/TestDictionary: Difference between revisions

From Path of Exile 2 Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
local p = {}
local p = {}
-- Sample data for testing
local dictionary = {
    ["Town"] = {
        ["Clearfell Encampment"] = "The first town found in the beginning of Act 1.",
    },
    ["Mechanic"] = {
        ["Attack"] = "This is the ability that is attached to your weapon. Skills and modifiers are calculated separately from this.",
    },
}


function p.getEntry(frame)
function p.getEntry(frame)
     local term = frame.args.term or "Unknown"
     local term = frame.args.term or "Unknown"
     local category = frame.args.category or "Town"
     local template = "DictionaryData"
     if dictionary[category] and dictionary[category][term] then
     return frame:expandTemplate{ title = template, args = { term = term } }
        return dictionary[category][term]
    else
        return "Entry not found."
    end
end
end


return p
return p

Latest revision as of 16:12, 11 December 2024

Module documentation[create] [purge]
local p = {}

function p.getEntry(frame)
    local term = frame.args.term or "Unknown"
    local template = "DictionaryData"
    return frame:expandTemplate{ title = template, args = { term = term } }
end

return p