View Single Post
08-23-18, 06:34 AM   #2
PhoenixPower
A Defias Bandit
Join Date: Aug 2011
Posts: 3
Lightbulb

The reason why the code is erroring is that GetChannelList() now returns 3 values per channel rather than 2. Also changed to a recursive style, adding another if statement with a modulus comparison seemed ugly. And I don't think anything is wrong with the SetText code, it just never got executed because it happens after the error trying to initialize the dropdown menu. Just replace the original ChannelsMenu_Initialize with this one and you should be good to go.

Lua Code:
  1. function ChannelsMenu_Initialize()
  2.     local function AddChannelsRecursively(id, name, disabled, ...)
  3.         local title = id .. ". " .. name;
  4.         ShowDebug("Found channel " .. title);
  5.  
  6.         local info = UIDropDownMenu_CreateInfo();
  7.         info.text = title;
  8.         info.value = id;
  9.         info.owner = ChannelsDropdown;
  10.         info.func = OnChannelsMenuClick;
  11.         UIDropDownMenu_AddButton(info);
  12.  
  13.         if ... then return AddChannelsRecursively(...) end
  14.     end
  15.     AddChannelsRecursively(GetChannelList());
  16. end

Last edited by PhoenixPower : 08-23-18 at 06:44 AM.
  Reply With Quote