View Single Post
07/06/14, 10:03 PM   #23
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
The code Garkin posted (before patch) is identical to what I have in source dated 19 Aug 2013 (yes 11 months old).

You seem to be misunderstanding what ZO_LinkHandler_ParseLink returns, and how # operator works.

ZO_LinkHandler_ParseLink has always returned multiple values. Not a table. The first returned value is the text contained at the end of the link (between |h tags).

# operator returns the length of its argument - its single argument. When you use a list of values (such as that returned from ZO_LinkHandler_ParseLink) in scalar context, Lua uses only the first value from the list. So, #ZO_LinkHandler_ParseLink(link) returns the length of the text (throwing away the rest of returned values). Since after the patch they stripped the text, the length is 0.

Now, if you want to know how many values ZO_LinkHandler_ParseLink returns, you can either put the results in a table and then use # operator to get its size:
Lua Code:
  1. local function parseLinkIntoTable(link)
  2.     local tab = {ZO_LinkHandler_ParseLink(link)}
  3.     return #tab, tab
  4. end
or, if you really want only the count and not the values, use select:
Lua Code:
  1. local function numLinkParams(link)
  2.     return select("#", ZO_LinkHandler_ParseLink(link))
  3. end


I don't think you're completely wrong with the performance issues, though. I noticed something evil right after Craglorn patch. Back then I only had 1 addon, SpentSkillPoints, and an old version of that which did no caching at all. After the patch, every time I opened my skills, there was a very noticeable delay before the window actually opened. The delay was much shorter before that patch, and it went away once I updated the addon. But something must've changed, perhaps they're throttling Lua instructions per timespan, I don't know.
  Reply With Quote