coding: superload v overload
Moderator: Moderator
coding: superload v overload
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?
Re: coding: superload v overload
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.
-
- Spiderkin
- Posts: 543
- Joined: Sat Feb 11, 2012 1:12 am
Re: coding: superload v overload
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)
Re: coding: superload v overload
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.
Re: coding: superload v overload
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.