Module:Tabber

Revision as of 02:19, 13 August 2015 by com>Ckwng (Created page with "local FrameObject = require('Module:FrameObject') local Tabber = BaseData{ _tag = 'tabber', _separator = '\n|-|\n' } function Tabber:create(data) data._tabs = {} return ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local FrameObject = require('Module:FrameObject')

local Tabber = BaseData{
	_tag = 'tabber',
	_separator = '\n|-|\n'
}

function Tabber:create(data)
	data._tabs = {}
	return self.__index:create(data)
end

function Tabber:add_tab(tab_name, tab_contents)
	table.insert(self._tabs, tab_name .. '=' .. tab_contents)
	self._tab_contents[tab_name] = tab_contents
end

function Tabber:__tostring()
	return FrameObject():extensionTag(self._tag, table.concat(self._tabs, self._separator))
end

return Tabber