Difference between revisions of "Module:InfoboxBuilding"

Jump to navigation Jump to search
Error "Lua error in Module:InfoboxBuilding at line 61: attempt to call global 'createDataRow' (a nil value)." after trying to invoke this with Template:BuildingInfobox, so after trying to learn a bit about LUA I am seeing if moving function createDataRow above localrowClass to see if it fixes it
(Testing for new building infobox template; credits for this draft to @levrin)
 
(Error "Lua error in Module:InfoboxBuilding at line 61: attempt to call global 'createDataRow' (a nil value)." after trying to invoke this with Template:BuildingInfobox, so after trying to learn a bit about LUA I am seeing if moving function createDataRow above localrowClass to see if it fixes it)
 
Line 50: Line 50:
     end
     end
      
      
     local rowClass = 'infobox-row'
     local function createDataRow(label, value, defaultValue)
    if columnCount then
        rowClass = rowClass .. ' data-rows-' .. columnCount
    end
   
    local rowContainer = mw.html.create('div')
    rowContainer:addClass(rowClass)
   
    for _, item in ipairs(data) do
        local dataRow = createDataRow(item.label, item.value, item.defaultValue)
        if dataRow then
            rowContainer:node(dataRow)
        end
    end
   
    box:node(rowContainer)
    return box
end
 
local function createDataRow(label, value, defaultValue)
     if not value and not defaultValue then
     if not value and not defaultValue then
         return nil
         return nil
Line 92: Line 73:
      
      
     return dataRow
     return dataRow
end
   
    local rowClass = 'infobox-row'
    if columnCount then
        rowClass = rowClass .. ' data-rows-' .. columnCount
    end
   
    local rowContainer = mw.html.create('div')
    rowContainer:addClass(rowClass)
   
    for _, item in ipairs(data) do
        local dataRow = createDataRow(item.label, item.value, item.defaultValue)
        if dataRow then
            rowContainer:node(dataRow)
        end
    end
   
    box:node(rowContainer)
    return box
end
end


606

edits

Navigation menu