General
refer to self (this)
Started by nikisoko on .
Sign in or create an account to join the conversation.
Is there a way to refer to the object that a script is acting on? What I mean is if I'm doing something like the following:
round(x*getattribute(MultiSlider, 'nbr'))
I would like to change MultiSlider to something like 'this' or 'self' so that I don't have to go in and edit the script every time I make change the name of the object or make a copy of the object.
Thanks,
-Nick
round(x*getattribute(MultiSlider, 'nbr'))
I would like to change MultiSlider to something like 'this' or 'self' so that I don't have to go in and edit the script every time I make change the name of the object or make a copy of the object.
Thanks,
-Nick
Hi
I think you want 'getobject()' passing nothing as the argument returns the enclosing object , ,
Use it by declaring something like
decl this = getobject();
out = round(x*getattribute(this, 'nbr'));
Can also be used to get/store references to any object
An implicit 'this' function has also been requested on the wishlist from memory . . .
Cheers
MM
I think you want 'getobject()' passing nothing as the argument returns the enclosing object , ,
Use it by declaring something like
decl this = getobject();
out = round(x*getattribute(this, 'nbr'));
Can also be used to get/store references to any object
An implicit 'this' function has also been requested on the wishlist from memory . . .
Cheers
MM
that works! thanks!
Thanks for asking about this Nick i've been asking myself how to do this, but have just moved on and continued working.
Macciza thank you sir for the answer! I remember someone asking for a ob ref 'this' as well.
Macciza thank you sir for the answer! I remember someone asking for a ob ref 'this' as well.
Macciza wrote:Hi
I think you want 'getobject()' passing nothing as the argument returns the enclosing object , ,
Use it by declaring something like
decl this = getobject();
out = round(x*getattribute(this, 'nbr'));
Can also be used to get/store references to any object
An implicit 'this' function has also been requested on the wishlist from memory . . .
Cheers
MM