Module:Tabs: Difference between revisions

Want an adless experience? Log in or Create an account.
I knew the logic was bad but not that bad. breaking it into two ifs for clarity
(some more whitespace stripping)
(I knew the logic was bad but not that bad. breaking it into two ifs for clarity)
 
Line 91: Line 91:


   for _, c in ipairs( self.contents ) do
   for _, c in ipairs( self.contents ) do
     if type( c.selection ) == 'table'
     if type( c.selection ) == 'string'
        and (self.tabsLeft and self.tabsLeft.defaultSelection == c.selection:gsub( "%s", "" )
        or self.tabsTop and self.tabsTop.defaultSelection == c.selection:gsub( "%s", "" )) then
      c.default = true
    elseif type( c.selection ) == 'table'
         and self.tabsLeft and self.tabsLeft.defaultSelection == c.selection.left:gsub( "%s", "" )
         and self.tabsLeft and self.tabsLeft.defaultSelection == c.selection.left:gsub( "%s", "" )
         and self.tabsTop and self.tabsTop.defaultSelection == c.selection.top:gsub( "%s", "" )
         and self.tabsTop and self.tabsTop.defaultSelection == c.selection.top:gsub( "%s", "" ) then
      or self.tabsLeft and self.tabsLeft.defaultSelection == c.selection:gsub( "%s", "" )
      or self.tabsTop and self.tabsTop.defaultSelection == c.selection:gsub( "%s", "" ) then
       c.default = true
       c.default = true
     end
     end