Jump to content

Error ???


Piorun

Recommended Posts

Hi guys.

Firstly i show you my code:

  
for k,v in ipairs(character) do 
local y = ( k - 1 )* 55 
charPane[k] = guiCreateScrollPane(7, 130 + y, 250, 50, false) 
charLabel[k][1] = guiCreateLabel(5,0,100,15,character[k],false,charPane[k]) 
guiSetFont(charLabel[k][1], "default-bold-small") 
end 

and I have error "attempt to index field '?' (a nil value)" in line:

charLabel[k][1] = guiCreateLabel(5,0,100,15,character[k],false,charPane[k]) 

WHAT's wrong?

Link to comment
  
local charPane = { } 
local charLabel = { } 
  
for k,v in ipairs( character ) do 
    local y = ( k - 1 )* 55 
    charPane[k] = guiCreateScrollPane( 7, 130 + y, 250, 50, false ) 
    charLabel[k] = guiCreateLabel( 5,0,100,15,v,false,charPane[k] ) 
    guiSetFont( charLabel[k], "default-bold-small" ) 
end 

Link to comment

Sorry, but in my code i have lines:

local charPane = { } 
local charLabel = { } 

but in future i want to add more labels something like that:

  
charLabel[k][1] = guiCreateLabel(5,0,100,15,character[k],false,charPane[k]) 
charLabel[k][2] = guiCreateLabel(5,0,100,15,"Something",false,charPane[k]) 
charLabel[k][3] = guiCreateLabel(5,0,100,15,"Something",false,charPane[k]) 
guiSetFont(charLabel[k][1], "default-bold-small") 
end 
  

but when I made it i have error.

Link to comment

you dont need the [k] here

  
  
charLabel[1] = guiCreateLabel(5,0,100,15,character[k],false,charPane[k]) 
charLabel[2] = guiCreateLabel(5,0,100,15,"Something",false,charPane[k]) 
charLabel[3] = guiCreateLabel(5,0,100,15,"Something",false,charPane[k]) 
for i,v in ipairs ( charLabel ) do 
guiSetFont(v, "default-bold-small") 
end 
end 
  

Link to comment

Wrong code al3grab

  
charLabel[1] = guiCreateLabel( 5,0,100,15,"Something",false ) 
charLabel[2] = guiCreateLabel( 5,0,100,15,"Something",false ) 
charLabel[3] = guiCreateLabel( 5,0,100,15,"Something",false ) 
  
for _,v in pairs ( charLabel ) do 
    guiSetFont( v, "default-bold-small" ) 
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...