Module:Test: Difference between revisions

From Roat Pkz
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
-- Module table
-- Module table
local prices = {}
local test = {}


-- Function to get price by item name
-- Function to get price by item name
function prices.getPrice(itemName)
function test.getPrice(itemName)
    mw.log("Attempting to retrieve price for item:", itemName) -- Debug print
     local data = mw.loadData("Module:GEPrices/data")
     local data = mw.loadData("Module:GEPrices/data")
     if not data then
     return data[itemName] or nil
        mw.log("Error: Module 'GEPrices/data' not found or failed to load.")
        return nil
    end
    mw.log("Data loaded successfully:", data) -- Debug print
    local price = data[itemName]
    mw.log("Price found:", price) -- Debug print
    return price or nil
end
end


return prices
return test

Revision as of 22:29, 3 April 2024

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

-- Module table
local test = {}

-- Function to get price by item name
function test.getPrice(itemName)
    local data = mw.loadData("Module:GEPrices/data")
    return data[itemName] or nil
end

return test