coding: superload v overload

Have a really dumb question? Ask it here to get help from the experts (or those with too much time on their hands)

Moderator: Moderator

Post Reply
Message
Author
IejirIsk
Halfling
Posts: 97
Joined: Fri Jul 11, 2014 7:43 am

coding: superload v overload

#1 Post by IejirIsk »

the title says most of it... but if i understanding, superload takes a single (or multiple) functions and replaces them entirely, and overload is the full file?

0player
Uruivellas
Posts: 717
Joined: Fri May 24, 2013 4:27 pm

Re: coding: superload v overload

#2 Post by 0player »

Yes, more or less. With superload, you get the class that was loaded originally (or modified by higher priority addons) and can modify it programmatically. With overload, you just replace the file.

stinkstink
Spiderkin
Posts: 543
Joined: Sat Feb 11, 2012 1:12 am

Re: coding: superload v overload

#3 Post by stinkstink »

It's worth noting for novices that superloading also allows you to prepend/append things to a function instead of overwriting it completely, which is usually what you want to do to avoid compatibility conflicts (as well as making it easier to keep updated)

IejirIsk
Halfling
Posts: 97
Joined: Fri Jul 11, 2014 7:43 am

Re: coding: superload v overload

#4 Post by IejirIsk »

stinkstink wrote:It's worth noting for novices that superloading also allows you to prepend/append things to a function instead of overwriting it completely, which is usually what you want to do to avoid compatibility conflicts (as well as making it easier to keep updated)

well, okay... the wiki mentioned that... but the example wasn't really clear for this old guy...
basically wanting to make a minor (like 1 or 2 line) change to :onHeal. ... or i guess technically, vile-life.

Marson
Uruivellas
Posts: 645
Joined: Thu Jan 16, 2014 4:56 am

Re: coding: superload v overload

#5 Post by Marson »

There are times when a prepend/append won't do the trick and you need to actually modify the function's internal code. I've run into this a lot for UI changes. In that case you need to overwrite the entire function.

Post Reply