- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Difference between revisions of "Module:Tabber"
Jump to navigation
Jump to search
com>Ckwng m |
com>Ckwng |
||
Line 10: | Line 10: | ||
data = data or {} | data = data or {} | ||
data._tabs = {} | data._tabs = {} | ||
+ | data.__tostring = self._tostring | ||
return self.__index.create(self, data) | return self.__index.create(self, data) | ||
end | end | ||
Line 17: | Line 18: | ||
end | end | ||
− | function Tabber: | + | function Tabber:_tostring() |
return FrameObject():extensionTag(self._tag, table.concat(self._tabs, self._separator)) | return FrameObject():extensionTag(self._tag, table.concat(self._tabs, self._separator)) | ||
end | end | ||
return Tabber | return Tabber |
Revision as of 02:56, 13 August 2015
Documentation for this module may be created at Module:Tabber/doc
local BaseData = require('Module:BaseData')
local FrameObject = require('Module:FrameObject')
local Tabber = BaseData{
_tag = 'tabber',
_separator = '\n|-|\n'
}
function Tabber:create(data)
data = data or {}
data._tabs = {}
data.__tostring = self._tostring
return self.__index.create(self, data)
end
function Tabber:add_tab(tab_name, tab_contents)
table.insert(self._tabs, tab_name .. '=' .. tab_contents)
end
function Tabber:_tostring()
return FrameObject():extensionTag(self._tag, table.concat(self._tabs, self._separator))
end
return Tabber