You need to set the frame's event handler.
Example:
Lua Code:
GuildLeader:SetScript("OnEvent",function(self,event)
if event=="WHO_LIST_UPDATE" then
for i=1,C_FriendList.GetNumWhoResults() do
local info=C_FriendList.GetWhoInfo(i);
-- Do something with character data in table "info"
end
-- Be nice and re-register the event so "/who" still works
FriendsFrame:RegisterEvent("WHO_LIST_UPDATE")
end
end);
See
C_FriendList.GetWhoInfo() for the structure of the table returned containing character data.
As a side note, there are a couple misconceptions.
C_FriendList.SetWhoToUI() expects a boolean value, you're giving it a number.
GuildLeader:RegisterEvent() only takes one argument, the event you're registering.