Jump to content

What is "AddChild" and "root" and how does it work?


Recommended Posts

Hi. I'm a beginner

Looking at some scripts, I saw that "AddChild" and "root" are often used. Is there a publication explaining what "AddChild" and "root" is and how it works? (And if not, someone could explain it to me?)

Thanks.

Link to comment
Share on other sites

self.root = self:AddChild(Widget("root"))

self, it references the widget. 
.root, creates a new index.
= assigns the right side into the index.
self, references the widget,
:AddChild, adds the first argument as a widget.
Widget, reference to the base widget element.
("root"), the name of the widget which is the first argument.

self.hand_inv = self.root:AddChild(Widget("hand_inv"))

Same thing as the above, except instead of root and "root" it is hand_inv and "hand_inv", and the child is being added into the previously created widget.

  • Like 3
Link to comment
Share on other sites

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
 Share

×
  • Create New...