Wikia

WoWWiki

Talk:Global functions/Archive01

101,697pages on
this wiki

Back to page | < Talk:Global functions

Oops yes I merged together the function lists for FrameXML and GlueXML. What's the policy, are we publishing GlueXML functions, or shall I take those out? - Lego

Uhm... leave them in, but perhaps a notification that they were extracted from the GlueXML?

I think they will work in the game as well, but... -- Sarf

We should purge them out. Edit

Thats my feeling on this matter.

Collect them up and put them in another page.

-Alex

I have separated out the GlueXML only functions and put them at the bottom. - Lego

The 58 additional FrameXML functions I added earlier, were deleted in separating the GlueXML functions? I will re-add them but I'm curious what your source for functions is Lego. It is missing things like BuyBackItem() and UnitPVPName(). - danboo

You are absolutely right, danboo, some functions were missing due to some bugs in the script I use to generate this list. Bear in mind that because this list is automatically generated, if you add anything by hand, it's likely to get deleted. If you notice something missing, please let me know rather than just including it on the list here.

I extract the list of global functions from the Blizzard .xml and .lua files. Consequently no functions are included that do not appear in any of the files. If you do know of such functions, let me know. The script I use to generate the list is:

Not Applicable any more

I use a separate script for finding which functions have already been included on the World of Warcraft API page and bold the ones that are not there yet.

Let me know if you see anything wrong with the script, it's already gone through a few incarnations. As it is, this script is a horrible hack. In the future I am thinking of doing something more solid for parsing the .xml and .lua files for functions.


Hmm, I may be confused. Is an API function one that is *not* defined as a 'function Foo ()' within the body of one of the .lua files? If so, then your script is picking up ActionButtonUp/Down (and a few others) as false positives.

Should there be a distinction between global functions intrinsic to the client and those defined in the FrameXML files?

Anyway, the perl script I used is below.

Cheers,

- danboo

#!/usr/bin/perl -nl

## chmod 755 find_api_functions
## cd FrameXML
## find_api_functions * > api_functions.txt

/\Afunction\s+(\w+)/ ? $lua{$1}++ : $api{$_}++
   for /((?:function\s+)?(?<!:)\b\w+)\(/g;

END { print for sort grep !$lua{$_}, keys %api }

The API Functions Edit

The API Functions should *NOT* be generated by function() blah end blocks. These should only be the stuff that is in the game that blizzard defined. The stuff in the FrameXML files should be in a separate list.

Though documenting blizzards code might be aibt out of our scope.


Ok I think I know what happened. We all agree that we don't want to document the functions in the .lua files. I see that Dunboo just extracted those functions not defined there. I pretty much meant the same thing, but I used the following rule-of-thumbs to extract global functions:

  • functions are those with alphanumeric name terminated by (
  • member functions have a leading :
  • global functions don't have underscores in them
  • global functions don't have a leading period

Now I know that my rules aren't perfect, and fall short in that some functions defined in the .lua files, such as ActionButtonDown, don't have underscores in them so they got classified as global functions. Also, I forgot about functions that have two leading periods, which in fact can be global (e.g. GetRealZoneText). However, this poses the question, especially to Alex: ActionButtonDown and a few other functions are in fact documented on the World of Warcraft API page, even though it's defined in ActionButton.lua. What should happen to these? -- Lego

Once and for all Edit

I ran enough circles around this problem now, and decided to sort it out once and for all. This is what I will do. This page is intended more as an indication, of what could still be potentially included on the World of Warcraft API page. Here are the rules for including functions here:

  • any function that appears in the .xml or .lua files is potentially a candidate
  • leading : means member function, so is not included
  • functions that have underscores are not included
  • functions that have a single leading period are not included
  • functions that have a double leading period are included

Explanation: I found that essentially having an underscore in the name means it's .lua defined, and specific to an object. When that's not the case, it's a typo or bug in Blizzard's programming (e.g. GameTooltip_SetOwner). On the other hand, there are a lot of functions that don't have underscores, yet still defined in the .lua files (e.g. ActionButtonDown). These are potentially useful to include on the API page, so are included here too.

I think the above is the best way to approach this. If you disagree, let me know.

Tough question. Edit

I'd say that we can allow some flux, but that in general, we should weed ones that area already documented into a "Blizzard Lua Code" page group or something. But letting this list be the "candidate" list is fine by me. -- AlexanderYoshi 19:55, 21 Nov 2004 (EST)

(You can make a signature like mine by typing -- ~~~~ )


Fair enough Lego and Alex. For now I'll stick to working on the API page, and coordinate with Lego if I have suggestions for the Global list.

- danboo 20:09, 21 Nov 2004 (EST)


Ok Alex's suggestion makes sense to me. I will eventually move to distinguish between internal and lua defined, but still useful global functions. Lego 20:27, 21 Nov 2004 (EST)

I have separated out the lua functions from the internal ones. I decided to remove the list of GlueXML functions since Blizz doesn't officially condone it's modding.

List is done Edit

Finally I got to verify all the functions in-game. There is separate list for Glue functions. Lego 09:10, 25 Nov 2004 (EST)

List is wrong or out of sync Edit

I've just done a slightly more complex scan of all of the 4150 Interface/FrameXML files, using an actual LUA parser rather than just scanning the text. A rough pass using lists of functions that are called versus a list of those which are defined produces a largely-but-not-quite consistent list from the one here. The AddSendMailCOD() function would be an example of one I dont see on this list, but it is called from MoneyFrame.lua.

It could be that this list is just old, it doesn't appear to have been updated with 4150 stuff at all, is this a historic document we dont care about anymore? Or should we be actively maintaining it? I'm hoping I can eventually get all my various utilties and scripts integrated enough that generating this list automatically AND reliably becomes feasible.

So I guess i'm asking a couple of things.

  • Is this list supposed to be up to date
  • If yes, what's the process for getting it refreshed

Until now i've been more or less ignoring it, and using the main API page as the reference version, adding in whatever's missing as I can.

-- Flickering 21:26, 31 Dec 2004 (EST)

This list is not generated directly from the Blizzard .lua files, for several reasons. It used to be generated by a method similar to what you have done. The latest version, that you see here, is generated by looking at WoW.exe. If you look at AddSendMailCOD(), it is indeed called from a .lua file, but that's actually out of date in the .lua file itself. Such a function doesn't exist any more (it used to be defined in .lua therefore it wasn't an internal function). That's one of the reasons why the list here is not generated from the .lua files.

As far as I know, the current list is up-to-date, but I will make a quick check and update when I have some time and/or access to WoW.

The way I generate it is this: I grab a list of potential function names from WoW.exe, then I use a script in-game to verify which one of those names is actually an existing global function. This is more reliable than scanning the .lua files, precisely because of things like AddSendMailCOD.

Also, this list has separate entries for internal functions vs. those defined in the .lua files. The first list is as complete as possible, the second list is only indicative and is not necessary up-to-date. That's where a script like yours comes in handy.

Oh, and the last thing: I also have a script like yours, and I do occassionally check the .lua defined/called functions against this list, to check for discrepancies like you describe. So far all the cases that I have seen has a reason similar to AddSendMailCOD.

-- Lego 09:32, 3 Jan 2005 (EST)

I guess I picked a really bad example 8-) I've done a filter against the list of executable strings I'd started off with (Likewise verified using an in-game script) and indeed that does drop a few off but there are still some discrepencies:

  • CancelMeetingStoneRequest
  • GetMeetingStoneStatusText
  • GetPluralIndex
  • IsInMeetingStoneQueue
  • ShowCloak
  • ShowHelm
  • ShowingCloak
  • ShowingHelm
  • ToggleCombatLogFileWrite
  • UpdateInventoryAlertStatus

Many of those are fairly new, so it could just be an instance of the scan having not been done since the 4150 patch? What I have NOT yet done is a back-scan (Taking the list of global symbols from the .lua files and checked those against the global symbol table ingame) - That shouldn't take more than a couple of minutes to throw together so I guess I'll do it now and see what it drags up.

-- Flickering 14:54, 3 Jan 2005 (EST)

You are absolutely right, it has not been updated to 4150 stuff, the ShowCloak etc. functions are missing. I will get on this as soon as I get a chance, meaning the start of EU Final Beta :-). In the meantime if you spot any functions that are missing, feel free to add them to the list.

I think I completely understand now what you are doing and where you are coming from, and I have one comment left to make. The .lua files don't actually make use of all possible internally defined functions. If you restrict your search to function calls found in the .lua files, you are going to miss out on a few functions, no matter how sophisticated your method is. That is why I prefer to get the list of functions directly from WoW.exe. In fact I usually do both:

  • get a list of potential functions from WoW.exe and verify using in-game script
  • get a list of functions called in the .lua files but not defined in the .lua files, just like you do, although in a less sophisticated way

I compare both lists to see if there is anything missing from either. So far I never found that the first list missing anything that the second one has, but I have found many that the second list misses.

In terms of what to do in the future: I recommend that we carry on using both approaches.

-- Lego 20:51, 4 Jan 2005 (EST)

Yup, we're on exactly the same page.. My process is (A) Scan .lua and .xml and create list of referenced globals (functions, variables, plus another script tuned for events).. (B) Scan WoW.exe for potential symbols (C) Scan both lists in-game to detemine which symbols are valid (D) correlate both lists.

-- Flickering 23:04, 4 Jan 2005 (EST)

Well, I have updated the list for 4150 for now. In the future, if a new patch comes out, feel free to update the list yourself if I haven't done it ;-)

There's another thing too, which is that I use an automated script to updated the bold/non-bold status of entries on this list.

-- Lego 12:32, 7 Jan 2005 (EST)

Latest patch (1.5.0) Edit

Updated for patch 1.5.0. I have removed GlueXML functions list since those are no longer modifiable.

From 1.5.0 onwards, since getfenv is available for scanning the global environment, it is no longer necessary to scan WoW.exe for global function names. The list on this page is now guaranteed to be accurate, as it is now generated by directly querying the in-game environment for all global functions.

Lego 16:07, 7 Jun 2005 (EDT)

Detection of what exists in WoW API page is broken Edit

Currently, the script doesn't detect functions that already exists in World of Warcraft API. It claims that everything is new =)

(Oh, I also took the liberty of explaining why the page exists in the intro, based off everyone's talk here -- most people don't read the Talk pages)

-- Mikk 18:35, 15 May 2006 (EDT)

Around Wikia's network

Random Wiki