Wei Posted June 17, 2013 Posted June 17, 2013 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) Diet with russian vodka, lose 3 days in one week !
Moderators IIYAMA Posted June 17, 2013 Moderators Posted June 17, 2013 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 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
mcer Posted June 17, 2013 Posted June 17, 2013 Error here guiSetText( playerListLabels[1][4], "woo" ) playerListLabels[1][4] / ERROR Replace with playerListLabels[i][4]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now