Module:Price: Difference between revisions

From Roat Pkz
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:


function p.main( frame )
function p.main( frame )
     return 'Hello, world!'
 
local args = frame:getParent().args
     -- Params and defaults
    local name, stock, buyvalue, sellvalue, geprice = params.defaults{
        {args.name or args.Name, ''},
        {args.stock or args.Stock, ''},
        {args.buy or args.Buy, ''},
        {args.sell or args.Sell, ''},
        {args.geprice or args.geprice, ''}
    }
    local itemvalue = ''
    local gemwname = params.default_to(args.gemwname,name)
    local smwname = params.default_to(args.smwname,name)
    local displayname = params.default_to(args.displayname or args.DisplayName,name)
    local image = 'File:' .. params.default_to(args.image or args.Image, name .. '.png')
    local gemw = yesno(args.gemw or 'yes', false)
    local restock = params.default_to(args.restock or args.Restock,-1)
   
    -- Check precached Module:GEPrices/data
    if gemw and geprice == '' then
        local cached_price = geprices_data[gemwname]
        if type(cached_price) == 'number' and cached_price > 0 then
            geprice = cached_price
        end
    end
 
 
 
 
 
 
end
end


return p
return p

Revision as of 18:25, 3 April 2024

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

local p = {}

function p.main( frame )

local args = frame:getParent().args
    -- Params and defaults
    local name, stock, buyvalue, sellvalue, geprice = params.defaults{
        {args.name or args.Name, ''},
        {args.stock or args.Stock, ''},
        {args.buy or args.Buy, ''},
        {args.sell or args.Sell, ''},
        {args.geprice or args.geprice, ''}
    }
    local itemvalue = ''
    local gemwname = params.default_to(args.gemwname,name)
    local smwname = params.default_to(args.smwname,name)
    local displayname = params.default_to(args.displayname or args.DisplayName,name)
    local image = 'File:' .. params.default_to(args.image or args.Image, name .. '.png')
    local gemw = yesno(args.gemw or 'yes', false)
    local restock = params.default_to(args.restock or args.Restock,-1)
    
    -- Check precached Module:GEPrices/data
    if gemw and geprice == '' then
        local cached_price = geprices_data[gemwname]
        if type(cached_price) == 'number' and cached_price > 0 then
            geprice = cached_price
        end
    end






end

return p