View Single Post
01-06-13, 01:32 PM   #5
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
Originally Posted by akgis View Post
thanks, but thats is abit out of my league...

Would you be so kind to exemplify in this how I can do it?

Code:
  function Whatever()
    (...)
|-->
|  (...)
| end
|
|- - <my code>
what I have to do so <my code> gets in the middle of the function Whatever like the "arrows" indicate
You can only pre- or post-hook a function. You can not split the function!


What you can do is:
Lua Code:
  1. function mainfunc(...)
  2.   --this is the function you want to alter/enhance
  3. end
Lua Code:
  1. --store the old (default) function before
  2. local old_mainfunc = mainfunc
  3. function mainfunc(...)
  4.    old_mainfunc(...) --if you want to run the old code first (this is better done via 'hooksecurefunc')
  5.    -- your code
  6.    old_mainfunc(...) --if you want to run the old code after your code is executed
  7. end


Please post the function you want to alter and the code you want to use. Then we can get more into detail.
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

Last edited by humfras : 01-06-13 at 01:51 PM.
  Reply With Quote