Thread Tools Display Modes
03/10/14, 10:06 AM   #1
Lodur
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 108
API func - private vs protected

Some API functions are marked private and some are marked protected.

Can anyone tell me the difference?
  Reply With Quote
03/10/14, 08:00 PM   #2
Myrroddin
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 28
If they are private, you cannot use or call those APIs. Consider them private to the game itself. We, as AddOn authors, are incapable of accessing private APIs.

Anything else we can use.
  Reply With Quote
03/11/14, 07:56 AM   #3
Lodur
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 108
Originally Posted by Myrroddin View Post
If they are private, you cannot use or call those APIs. Consider them private to the game itself. We, as AddOn authors, are incapable of accessing private APIs.

Anything else we can use.
Do you know about the ones marked protected? Just the same as public for all purposes? Or is there a subclass or subtype aspect like the name would imply in an OO language?
  Reply With Quote
03/11/14, 08:30 AM   #4
Myrroddin
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 28
Protected usually means we can use it under certain restrictions. For example, a protected API may not work correctly, if at all, in combat.

In WoW-speak, calling Show and Hide on a frame is alright in combat, provided you created the frame beforehand. However, if you tried creating the frame in combat and then called Show on it, you would get Interface Action Failed errors, and nothing would happen visibly. Same goes with changing a frame's attributes. Those have to be defined out of combat, and cannot be changed during.

Without me actually looking at the API list (being lazy here) I can't be more specific. But most of the time, calling protected APIs in combat will not work.

Last edited by Myrroddin : 03/11/14 at 08:33 AM.
  Reply With Quote
03/11/14, 12:33 PM   #5
Lodur
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 108
Originally Posted by Myrroddin View Post
Protected usually means we can use it under certain restrictions. For example, a protected API may not work correctly, if at all, in combat.

...

Without me actually looking at the API list (being lazy here) I can't be more specific. But most of the time, calling protected APIs in combat will not work.

Well I just skimmed all the protected functions in the API. I think not working in combat is a very reasonable assumption.

Thanks.
  Reply With Quote
03/13/14, 02:17 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Protected may also mean that something requires a hardware event to initiate the function call.
  Reply With Quote
03/28/14, 06:11 AM   #7
skyraker
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 154
Have any of us addon developers used a protected function yet?
  Reply With Quote
04/09/14, 06:50 AM   #8
beeradg
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
Using protected functions... was annoying

I submitted an addon that uses the "protected" functions - and works.

Here's a git repo https://github.com/bradgearon/eso-stuff

Stuff.lua line 11 and 14 are the important chunks...
  Reply With Quote
04/21/14, 02:17 AM   #9
qgi
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 3
There seem to be further restrictions for some of the protected functions.

I tried to call "UseItem" in the same way (passing the function name to CallSecureProtected as a string as the first parameter, followed by the other arguments).
Although the function call returns true, nothing happens.

Any ideas?

Lua Code:
  1. result = CallSecureProtected("UseItem", bagId, slotndex)
  Reply With Quote
04/21/14, 09:01 AM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
When did you try to call this function?
  Reply With Quote
04/21/14, 09:13 AM   #11
qgi
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 3
Sorry, I just tried it again and it worked. No idea, why it hadn't in the first place. Maybe a typo.
  Reply With Quote
04/21/14, 09:18 AM   #12
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
My question though is still important.

Were you attempting to do it in combat?
  Reply With Quote
04/21/14, 09:20 AM   #13
qgi
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 3
Originally Posted by Seerah View Post
My question though is still important.

Were you attempting to do it in combat?
Sorry
[EDIT] It does work outside of combat in normal walk/run/stand mode but doesn't in combat [/EDIT]

Last edited by qgi : 04/21/14 at 09:31 AM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » API func - private vs protected


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