Anonymous

Module:Shop: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 23: Line 23:
-- Prevents external modules from having to make GameData and Common calls.
-- Prevents external modules from having to make GameData and Common calls.
function p.getCategoryPurchases(checkFunc, category)
function p.getCategoryPurchases(checkFunc, category)
local cat = GameData.getEntityByName('shopCategories', category)
local shopCat = GameData.getEntityByName('shopCategories', category)
if shopCat == nil then
if shopCat == nil then
return Shared.printError('Invalid category ' .. cat)
return Shared.printError('Invalid category ' .. shopCat)
end
end
Line 32: Line 32:
local func =  
local func =  
function(purchase)
function(purchase)
if purchase.category ~= shopCat.id then
return false
end
local name = Common.getPurchaseName(purchase)
local name = Common.getPurchaseName(purchase)
return checkFunc(purchase, name)
return checkFunc(purchase, name)
2,875

edits