Module:ManualDescriptions: Difference between revisions

From August Wiki
Jump to navigation Jump to search
Created page with "-- Module:ItemDescriptions -- Create this as a MediaWiki page that contributors can edit directly local p = {} -- Editable data table - contributors modify this directly local descriptions = { ["Bronze sword"] = { description = "A basic bronze weapon perfect for new warriors starting their adventure.", contributor = "Steve", date_updated = "2025-01-15" }, ["Iron ore"] = { description = "Raw iron that can be smelted into useful..."
 
No edit summary
Line 5: Line 5:
-- Editable data table - contributors modify this directly
-- Editable data table - contributors modify this directly
local descriptions = {
local descriptions = {
     ["Bronze sword"] = {
     ["BronzeSword"] = {
         description = "A basic bronze weapon perfect for new warriors starting their adventure.",
         description = "A basic bronze weapon perfect for new warriors starting their adventure.",
         contributor = "Steve",
         contributor = "Steve",
         date_updated = "2025-01-15"
         date_updated = "2025-01-15"
     },
     },
     ["Iron ore"] = {
     ["IronOre"] = {
         description = "Raw iron that can be smelted into useful bars for smithing.",
         description = "Raw iron that can be smelted into useful bars for smithing.",
         contributor = "Steve",  
         contributor = "Steve",  

Revision as of 06:18, 16 August 2025

Documentation for this module may be created at Module:ManualDescriptions/doc

-- Module:ItemDescriptions
-- Create this as a MediaWiki page that contributors can edit directly
local p = {}

-- Editable data table - contributors modify this directly
local descriptions = {
    ["BronzeSword"] = {
        description = "A basic bronze weapon perfect for new warriors starting their adventure.",
        contributor = "Steve",
        date_updated = "2025-01-15"
    },
    ["IronOre"] = {
        description = "Raw iron that can be smelted into useful bars for smithing.",
        contributor = "Steve", 
        date_updated = "2025-01-14"
    }
    -- Contributors add new items here by editing this page
}

function p.getDescription(frame)
    local itemName = frame.args[1] or ""
    local item = descriptions[itemName]
    
    if item then
        return string.format('%s <small>(Updated by [[User:%s|%s]] on %s)</small>', 
                           item.description, item.contributor, item.contributor, item.date_updated)
    end
    
    return string.format("''No description available for %s. Please edit [[Module:ItemDescriptions]] to add one.''", itemName)
end

return p