-
Posted by oliverjp on Wed, 17 Feb 2010 22:14:53
I want to create a table of the channel #s and names of channels the user has subscribed. I know that GetChannelList returns these values as pairs id1, name1, id2, name2, ... = GetChannelList();
I have developed a blind spot and can not get the id/name pairs into a table. Help? (Yes, I know its a dumb question and that anyone trying to write addons should understand such a simple thing ... please help anyway if you can)
-
Posted by jnwhiteh on Wed, 17 Feb 2010 23:35:02
I want to create a table of the channel #s and names of channels the user has subscribed. I know that GetChannelList returns these values as pairs id1, name1, id2, name2, ... = GetChannelList();
I have developed a blind spot and can not get the id/name pairs into a table. Help? (Yes, I know its a dumb question and that anyone trying to write addons should understand such a simple thing ... please help anyway if you can)
function buildChannelList(...) local tbl = {} for i = 1, select("#", ...), 2 do local id, name = select(i, ...) tbl[id] = name end return tbl end
Then
/dump buildChannelList(GetChannelList())
-
Posted by oliverjp on Thu, 18 Feb 2010 23:08:32
This was just what I needed ... thanks!