Jump to content

Module:BucketShow

From The Petit Planet Wiki
Revision as of 04:54, 16 May 2026 by Stevium (talk | contribs)
Module documentation

The documentation for this module is missing. Click here to create it.

-- Imported from: https://oldschool.runescape.wiki/w/Module:BucketShow

local p = {}

function p.show(frame)
	local args = frame:getParent().args
	local bucket_name = mw.text.trim(args[1] or '')
	local select_field = mw.text.trim(args[2] or '')
	
	local b = mw.bucket(bucket_name).select(select_field).limit(1)
	
	for k, v in pairs(args) do
		if k ~= 1 and k ~= 2 then
			b.where(k, v)
		end
	end
	
	local data = b.run()
	
	if data[1] and data[1][select_field] then
		data = data[1][select_field]
		
		if type(data) == 'table' then
			data = data[1]
		end
		
		return data
	end
	
end

return p