WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Need some clarification regarding "C_xxxxxx" functions (https://www.wowinterface.com/forums/showthread.php?t=56215)

seyan777 05-11-18 09:22 PM

Need some clarification regarding "C_xxxxxx" functions
 
For example, there are C_ArtifactUI, C_EncounterJournal and etc. which holds bunch of their own functions.

But, why do they all have prefix "C_"? How are they different from ordinary functions?

VincentSDSH 05-12-18 02:03 AM

They aren't different from the normal APIs. The naming convention is likely for internal housekeeping and organization, differentiating them from Lua functions from their Addons, such as this line from addons\Blizzard_MapCanvas.lua, in :RefreshDetailLayers()
Lua Code:
  1. for layerIndex = 1, C_MapCanvas.GetNumDetailLayers(self.mapID) do
If you called that MapCanvas.GetNumDetailLayers, then there'd be some question as to whether it was a Lua function or a C function, which can be a huge debugging headache for a developer (I speak from experience).

Banknorris 05-12-18 02:57 AM

I think C_XXXX functions are not written in Lua but in C.

Phanx 05-12-18 06:14 AM

Quote:

Originally Posted by Banknorris (Post 327956)
I think C_XXXX functions are not written in Lua but in C.

Yes, that's the whole point of everything explained in this thread. ;)


All times are GMT -6. The time now is 08:46 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI