Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Apidcloud on April 01, 2011, 10:02:24 am

Title: Super placed in def dispose?
Post by: Apidcloud on April 01, 2011, 10:02:24 am
Hey there again :P

Blizzard already explained me the use of supers, but I've one doubt or two xD

On the dispose method, should I do as in initialize one?
I mean, if I use 'super()' at initialize method , then at dispose method should I put 'super()' or just 'super' ?

Same question when I need to put arguments on the super...

class xxx < YYY
 def initialize
    super(d, d, d)
    #code
 def dispose
    self.contents.clear
    super(d, d, d)
 end
end


My other doubt, was about the 'order' or the code at dispose method...
On the previous case I used 'self.contents.clear' first, but it is the correct order? What should I write first, and what are the differences between the different orders? :P



Appreciated (:
Title: Re: Super placed in def dispose?
Post by: ForeverZer0 on April 01, 2011, 03:38:47 pm
The () are only used if the method of the super has arguments. If it doesn't have arguments, which most dispose methods won't, you casn omit the ().
Title: Re: Super placed in def dispose?
Post by: Apidcloud on April 02, 2011, 10:12:45 am
Then even If super has arguments, at def dispose I can omit them?
Title: Re: Super placed in def dispose?
Post by: Blizzard on April 02, 2011, 10:33:42 am
Yes.
Title: Re: Super placed in def dispose?
Post by: Apidcloud on April 02, 2011, 11:20:14 am
Thanks a lot :P