Jump to content

I have a question


Hero192

Recommended Posts

Posted

Can any one explain that?

I see alot of scripters create GUI elements and define them with a empty table, can I know why that?

For example:

local GUI = {} 
GUI["window"] = {}  
  
GUI["window"][1] = guiCreateWindow( ... ) 
  

Thanks in advance..

Posted
To create a table and fill it later ...

I mean, what's the difference if I created a GUI without defining it with a table, and without a table

Posted
local GUI = {} 
GUI["label"] = {} 
  
GUI["label"][1] = guiCreateLabel( ... ) 
GUI["label"][2] = guiCreateLabel( ... ) 
GUI["label"][2] = guiCreateLabel( ... ) 
  
for _, guiElement in ipairs(GUI["label"]) do 
  guiSetVisible(guiElement, true) 
end 
  
-- or 
  
guiSetVisible(GUI["label"][1], true) 
guiSetVisible(GUI["label"][2], true) 
guiSetVisible(GUI["label"][3], true) 
  
-- Both usage is the same. But the first usage look like clear than second one. 
  
  

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