Jump to content

Table Labels Problem


Wei

Recommended Posts

for i = 1, maxPlayersInCurList do 
        playerListLabels[i] = {} 
        playerListLabels[i][1] = guiCreateLabel(10, 30 - 15 + 15 * i, 188, 17, "", false, GUIEditor.gridlist[1]) 
        playerListLabels[i][2] = guiCreateLabel(207, 30 - 15 + 15 * i, 143, 17, "", false, GUIEditor.gridlist[1]) 
        playerListLabels[i][3] = guiCreateLabel(364, 30 - 15 + 15 * i, 128, 17, "", false, GUIEditor.gridlist[1]) 
        playerListLabels[i][4] = guiCreateLabel(501, 30 - 15 + 15 * i, 37, 18, "", false, GUIEditor.gridlist[1])    
        end 

when I try to change the one of the labels like this

guiSetText(  playerListLabels[1][4], "woo" ) 

I get error:

Attempt to index field '?' (a nil value)

Link to comment
  • Moderators

you sure the field does exist?

Well this is happening:

playerListLabels[1]= nil -- the problem. 
playerListLabels[1][4] -- cause the error. 
------ to solve the error, but preventing it always better. 
if playerListLabels[1] --[[and isElement(playerListLabels[1][4])]] then 
    guiSetText(  playerListLabels[1][4], "woo" ) 
end 
  

I have no idea why it doesn't exist. It is probably is happing in another part.

Can cause this: maxPlayersInCurList is nil/0

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...