Jump to content

country return nil


Fabioxps

Recommended Posts

country because it returns an error value nil?

function CToptimes:doOnServerSentToptimes( data, serverRevision, playerPosition ) 
    outputDebug( 'TOPTIMES', 'CToptimes:doOnServerSentToptimes ' .. tostring(#data) ) 
  
    -- Calc number lines to use and height of window 
    local numLines = math.clamp( 0, #data, 50 ) 
    self.size.y = 15 + 46 + 15 * numLines 
  
    -- Set height of window 
    local sizeX = self.size.x 
    local sizeY = self.size.y 
    guiSetSize( self.gui['windowbg'], sizeX, sizeY, false ) 
  
    -- Make listTimes contains the correct number of labels 
    self:updateLabelCount(numLines) 
  
    -- Update the list items 
    for i=1,numLines do 
  
        local timeText = data[i].timeText 
        if timeText:sub(1,1) == '0' then 
            timeText = '  ' .. timeText:sub(2) 
        end 
        if data[i].dateRecorded == "nil" then 
            data[i].dateRecorded = "30.03.2012" 
        end 
        if fileExists(":admin/client/images/flags/"..country[i]..".png") then 
        country[i] = ":admin/client/images/flags/"..country[i]..".png" 
        end 
        local line = string.format( '%d.   %s   %s   %s', i,timeText,data[i].dateRecorded,country[i],data[i].playerName ) 
        guiSetText ( self.gui['listTimes'][i], line ) 
  
        if i == playerPosition then 
            guiLabelSetColor ( self.gui['listTimes'][i], 0, 255, 255 ) 
        else 
            guiLabelSetColor ( self.gui['listTimes'][i], 255, 153, 0 ) 
        end 
  
    end 
  
    -- Debug 
    if _DEBUG_CHECK then 
        outputDebug( 'TOPTIMES', 'toptimes', string.format('crev:%s  srev:%s', tostring(self.clientRevision), tostring(serverRevision) ) ) 
        if self.clientRevision == serverRevision then 
            outputDebug( 'TOPTIMES', 'Already have this revision' ) 
        end 
    end 
  
    -- Update status 
    self.clientRevision = serverRevision 
    self.listStatus = 'Full' 
    self:updateShow() 
end 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...