View Single Post
09-09-23, 12:22 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,906
I don't use HandyNotes so I don't know all the ins-n-outs.

The iterator is cycling through your points table for the current map id. (23 [EPL] in the table in your code).
for each successful
Code:
next(...)
state will be the coord id. (number eg. 27592144 or 15606640) and value will be the corresponding sub-table in points[uiMapId]

To work the function would look more like:

Lua Code:
  1. local get_the_best_icon = function(point) -- point is the coord sub-table
  2.     if not point then return end -- should never happen but...
  3.     local relevant_icon = point["icon_type"]
  4.     local completed_icon = "complete.tga"
  5.     local folder_dir = "Interface/AddOns/HandyNotes_EfficientSee/Icons/"
  6.     if task_id == "skipme" then -- task_id not really usable here as it stands so a re-think needed.
  7.             local show_icon = folder_dir..completed_icon
  8.             return show_icon
  9.     else
  10.             local show_icon = folder_dir..relevant_icon -- This will prolbably be the only icon returned
  11.             return show_icon
  12.     end
  13.     return show_icon -- will never get here because of the if/else nature of the stgatement above.
  14. end

If the function is being used elsewhere you would use something like
Lua Code:
  1. if points[whatevertheMapIdis] and points[whatevertheMapIdis][whatevertheCoordIdis] then
  2.     local icon = get_the_best_icon = get_the_best_icon(points[whatevertheMapIdis][whatevertheCoordIdis])
  3.     -- do whatever with the icon
  4. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-09-23 at 05:19 PM.
  Reply With Quote