Difference between revisions of "Module:Silent1/sandbox"

From Idlescape Wiki
Jump to navigation Jump to search
m
m
Line 15: Line 15:
 
end
 
end
  
function p._price(frame)
+
function p._price(item)
return p.loadPrice (frame.args[0], 'price')
+
return p.loadPrice (item, 'price')
 
end
 
end
  
 
return p
 
return p

Revision as of 07:07, 10 February 2022


local p = {}

local data_module_names = {
	price = 'Module:MarketPrices/data'
}
local loaded_data_modules = {}

function p.loadPrice (item, data_type) 
	local module_name = data_module_names[data_type]
	if loaded_data_modules[module_name] == nil then
		loaded_data_modules[module_name] = mw.loadData(module_name)
	end
	
	return loaded_data_modules[module_name][item]
end

function p._price(item)
	return p.loadPrice (item, 'price')
end

return p