Ok so i am like brand new to coding, and I'm seeing the variable "Self" everywhere, and i can't find anything about it. Is that equivalent to ply? or what. sorry if it is a nebbish question but i need help.
You need to be specific in coding with capitals. There is no such thing as "Self" unless it is defined by [i]you[/i], it's "self". Capitals matter!
yeah i meant self, i didn't capitalize it in my code. but what is it?
[QUOTE=rocco1233;46187933]yeah i meant self, i didn't capitalize it in my code. but what is it?[/QUOTE]
When you define a function like this [lua]function myobject:myfunction(a,b,c)[/lua] it actually defines it like this [lua]function myobject.myfunction(self,a,b,c)[/lua]
And when you call a function like this [lua]myobject:myfunction(1,2,3)[/lua] it actually calls it like this [lua]myobject.myfunction(myobject,1,2,3)[/lua]
When you use : it passes the object you are calling as the first parameter, named self.
Sorry, you need to Log In to post a reply to this thread.