Module:Subobjecthelper

From Old School RuneScape Wiki
Jump to: navigation, search
Module documentation
This documentation is transcluded from Template:No documentation/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Subobjecthelper/doc. [edit]
Module:Subobjecthelper's function main is invoked by Template:GemDropTable.
Module:Subobjecthelper's function main is invoked by Template:RareDropTable.

local p = {}

function p.main(frame)
	local args = frame.args
	local subobj = {}
	for k,v in pairs(args) do
		if not (k == 'splitpoint' or k == 'subobjectname') then
			v = v:gsub('[\r\n]', '')
			subobj[k] = mw.text.split(v, args.splitpoint or '&split&')
		end
	end
	if args.subobjectname then
		mw.smw.subobject(subobj, args.subobjectname)
	else	
		mw.smw.subobject(subobj)
	end
end

return p