Quantcast Calling or hooking local functions of another addon? - WoWInterface
Thread Tools Display Modes
11-09-18, 08:00 PM   #1
LudiusMaximus
A Fallenroot Satyr
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 24
Calling or hooking local functions of another addon?

I have been working for a long time on my fork of the addon DynamicCam, in which I made substantial adjustments regarding the "camera over shoulder offset". I would like to make my changes publicly avaibable to the community, but as my pull request has been ignored so far, all I can do is tell people to manually download my fork code from github. Because surely it would be inappropriate to just upload the entirety of my fork under my name with all the other author's work in it, right?

That's why I thought of offering my changes as a plugin to DynamicCam, but I am facing the obstacle that there are several local functions of DynamicCam's Core.lua file that I would need to call or alter (i.e. hook).

Is there any way at all to do this?

Or what are my other options?
  Reply With Quote
11-09-18, 08:14 PM   #2
Tim
A Cobalt Mageweaver
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 244
What most people do to sort of bypass the default copyright limitations is to just upload your own version of the addon but, include something along the lines of fan update. (ie: DynamiCam [Fan Update]) However, looking at the GitHub for the addon there is a license file in which it states you can do whatever you want with the code without limitations. Proceed in the direction you feel best at doing so.
__________________
AddOns: Tim @ WoWInterface
Characters: Demon Hunter, Death Knight, Rogue
Current PC Setup: PCPartPicker List
  Reply With Quote
11-10-18, 07:03 AM   #3
Nimhfree
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 248
Originally Posted by LudiusMaximus View Post
<SNIP>

That's why I thought of offering my changes as a plugin to DynamicCam, but I am facing the obstacle that there are several local functions of DynamicCam's Core.lua file that I would need to call or alter (i.e. hook).

Is there any way at all to do this?

Or what are my other options?
I believe there is no way to access the local functions from outside, so the only way really would be to reimplement the local functions with your version and then continue to reimplement the callers all the way up until you get them all.
  Reply With Quote
11-10-18, 09:59 AM   #4
Tim
A Cobalt Mageweaver
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 244
Originally Posted by Nimhfree View Post
I believe there is no way to access the local functions from outside, so the only way really would be to reimplement the local functions with your version and then continue to reimplement the callers all the way up until you get them all.
Correct. When people post code on this forum you will commonly see one of the first things said to them is to convert their unnecessary global functions to their addons local scope to prevent any potential overlapping/interference between other addons. The only way you're going to be able to hook an addons function is if the desired functions are global. You've mentioned you've been using a fork of DynamicCam so really you could just go in and convert the functions to global and then proceed that way.
__________________
AddOns: Tim @ WoWInterface
Characters: Demon Hunter, Death Knight, Rogue
Current PC Setup: PCPartPicker List
  Reply With Quote
11-10-18, 04:37 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,252
Of course you can always ask the developer to create a global accessor for said function. Whether they will agree is another matter.
__________________
  Reply With Quote
11-10-18, 04:44 PM   #6
LudiusMaximus
A Fallenroot Satyr
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 24
Originally Posted by Xrystal View Post
Of course you can always ask the developer to create a global accessor for said function. Whether they will agree is another matter.
By "global accessor" you mean a global function that can be called instead of the local function, which simply passes its arguments on to a call of the local function?

I doubt that such a request would be successful here as I have not even had a reaction to my pull request for over two months now.

But I shall try the above suggested way of reimplementing the local functions in my own code and override all of DynamicCam's global functions that were calling them.

Thank you all!
  Reply With Quote
11-11-18, 03:48 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,556
Originally Posted by Tim View Post
What most people do to sort of bypass the default copyright limitations is to just upload your own version of the addon but, include something along the lines of fan update. (ie: DynamiCam [Fan Update]) However, looking at the GitHub for the addon there is a license file in which it states you can do whatever you want with the code without limitations. Proceed in the direction you feel best at doing so.
Anyone doing so with an item that is All Rights Reserved is still in violation of Copyright and the addon will be pulled from the site if a complaint is registered or we are aware of such restrictions by the author. (Remember: the absence of a license is the absence of permission, meaning it is All Rights Reserved.)



Now, to the OP...
DynamicCam has this as its license: https://github.com/Mpstark/DynamicCa...ter/LICENSE.md

You are free to modify and redistribute it under its license. I would add "Fan Update" or your name to the file to distinguish it from the original.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-11-18, 04:18 PM   #8
Tim
A Cobalt Mageweaver
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 244
Originally Posted by Seerah View Post
Anyone doing so with an item that is All Rights Reserved is still in violation of Copyright and the addon will be pulled from the site if a complaint is registered or we are aware of such restrictions by the author. (Remember: the absence of a license is the absence of permission, meaning it is All Rights Reserved.)
Of course I would expect said addon(s) to be removed if there was complaints. However, you can pretty much do a search on the site with the query or "Fan Update" and then compare those to the original addons and they're the same but with perhaps altered/updated code to work with newer versions of the game. I'm not going to go and download all of them and see if there's a license for each to see if they're in violation but, I'm sure more than not do not have a non-all rights reserved license.
  Reply With Quote
11-11-18, 09:47 PM   #9
myrroddin
A Molten Giant
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 944
If no license is specified, then legally it defaults to All Rights Reserved. In that case you must fork and modify your work by a certain percentage. I don't remember what that percentage is, and it probably varies country to country.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Calling or hooking local functions of another addon?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off