Deicon Posted August 28, 2020 Share Posted August 28, 2020 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 More sharing options...
Deicon Posted August 28, 2020 Author Share Posted August 28, 2020 Thanks for the answer. For example, what are these expressions below doing? self.root = self:AddChild(Widget("root")) self.hand_inv = self.root:AddChild(Widget("hand_inv")) Link to comment Share on other sites More sharing options...
Well-met Posted August 28, 2020 Share Posted August 28, 2020 oh, this is for widgets. Ignore my previous post can't help you there 1 Link to comment Share on other sites More sharing options...
penguin0616 Posted August 29, 2020 Share Posted August 29, 2020 AddChild adds the provided widget as a child. Think of it like adopting the widget and calling it your child? 2 Link to comment Share on other sites More sharing options...
Deicon Posted August 29, 2020 Author Share Posted August 29, 2020 Thanks for the answer. Can you explain step by step what the expression mentioned above does? Link to comment Share on other sites More sharing options...
penguin0616 Posted August 30, 2020 Share Posted August 30, 2020 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. 3 Link to comment Share on other sites More sharing options...
Deicon Posted August 30, 2020 Author Share Posted August 30, 2020 Thank you very much. Link to comment Share on other sites More sharing options...
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