View Single Post
03/28/24, 04:25 PM   #1
SSM24
 
SSM24's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2023
Posts: 4
Question about CallSecureProtected

I was looking at the API page and I noticed it says this:

To call a protected function, you must use the following code :

Lua Code:
  1. if IsProtectedFunction("TheNameOfYourFunction") then
  2.     CallSecureProtected("TheNameOfYourFunction", arg1, arg2, arg3)
  3. else
  4.     TheNameOfYourFunction(arg1, arg2, arg3)
  5. end
However in the past I've simply just used CallSecureProtected without checking IsProtectedFunction first (specifically when I used RequestMoveItem in Restock Bank Materials) and I haven't run into issues or had any reported. But it says on the API page you "must" use that first form, in bold and everything. Out of curiosity, what exactly is the benefit of doing so? Is it just for forward compatibility in case they un-protect an API function in the future, or is there another reason?
  Reply With Quote