<commit_before>local R, L, P, G = unpack(select(2, ...)) --Import: Engine, Locales, ProfileDB, GlobalDB
local IF = R:GetModule("InfoBar")

--Cache global variables
--Lua functions
local ipairs, select = ipairs, select
local wipe = table.wipe
local string = string
local tonumber = tonumber
local tinsert = table.insert

--WoW API / Variables
local CreateFrame = CreateFrame
local IsAltKeyDown = IsAltKeyDown
local BNInviteFriend = BNInviteFriend
local InviteUnit = InviteUnit
local ChatFrame_SendSmartTell = ChatFrame_SendSmartTell
local ChatFrame_SendTell = ChatFrame_SendTell
local GetNumFriends = GetNumFriends
local GetFriendInfo = GetFriendInfo
local UnitFactionGroup = UnitFactionGroup
local BNGetNumFriends = BNGetNumFriends
local BNGetFriendInfo = BNGetFriendInfo
local BNet_GetClientTexture = BNet_GetClientTexture
local BNGetGameAccountInfo = BNGetGameAccountInfo
local GetRealmName = GetRealmName
local GetQuestDifficultyColor = GetQuestDifficultyColor
local ToggleFriendsFrame = ToggleFriendsFrame
local InCombatLockdown = InCombatLockdown
local ShowFriends = ShowFriends

--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS: DEFAULT_CHAT_FRAME, FRIENDS_BNET_NAME_COLOR, FRIENDS_TEXTURE_AFK, FRIENDS_TEXTURE_DND
-- GLOBALS: FRIENDS_TEXTURE_ONLINE, FACTION_HORDE, FACTION_ALLIANCE, NAME, LEVEL_ABBR
-- GLOBALS: ZONE, FACTION, FRIENDS, GAME, FriendsFrame_HasInvitePermission

local friendsTablets = LibStub("Tablet-2.0")
local FriendsTabletData = {}
IF.FriendsTabletDataNames = {}
local FriendsOnline = 0
local displayString = string.join("", "%s: ", "", "%d|r")
local FriendsCat
local resSizeExtra

local ClassLookup = {}
for k, v in pairs(LOCALIZED_CLASS_NAMES_MALE) do
    ClassLookup[v] = k
end
for k, v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do
    ClassLookup[v] = k
end

local function Friends_TabletClickFunc(name, iname, toonid)
    if not name then return end
    if IsAltKeyDown() then
        if not FriendsFrame_HasInvitePermission() then return end
        if toonid then
            BNInviteFriend(toonid)
        elseif iname == "" then
            InviteUnit(name)
        else
            InviteUnit(iname)
        end
    else
        if toonid then
            ChatFrame_SendSmartTell(name, DEFAULT_CHAT_FRAME)
        else
            ChatFrame_SendTell(name, DEFAULT_CHAT_FRAME)
        end
    end
end

local function Friends_BuildTablet()<commit_msg>bug fix<commit_after>local R, L, P, G = unpack(select(2, ...)) --Import: Engine, Locales, ProfileDB, GlobalDB
local IF = R:GetModule("InfoBar")

--Cache global variables
--Lua functions
local ipairs, select = ipairs, select
local wipe = table.wipe
local string = string
local tonumber = tonumber
local tinsert = table.insert

--WoW API / Variables
local CreateFrame = CreateFrame
local IsAltKeyDown = IsAltKeyDown
local BNInviteFriend = BNInviteFriend
local InviteUnit = InviteUnit
local ChatFrame_SendSmartTell = ChatFrame_SendSmartTell
local ChatFrame_SendTell = ChatFrame_SendTell
local GetNumFriends = GetNumFriends
local GetFriendInfo = GetFriendInfo
local UnitFactionGroup = UnitFactionGroup
local BNGetNumFriends = BNGetNumFriends
local BNGetFriendInfo = BNGetFriendInfo
local BNet_GetClientTexture = BNet_GetClientTexture
local BNGetGameAccountInfo = BNGetGameAccountInfo
local GetRealmName = GetRealmName
local GetQuestDifficultyColor = GetQuestDifficultyColor
local ToggleFriendsFrame = ToggleFriendsFrame
local InCombatLockdown = InCombatLockdown
local ShowFriends = ShowFriends

--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS: DEFAULT_CHAT_FRAME, FRIENDS_BNET_NAME_COLOR, FRIENDS_TEXTURE_AFK, FRIENDS_TEXTURE_DND
-- GLOBALS: FRIENDS_TEXTURE_ONLINE, FACTION_HORDE, FACTION_ALLIANCE, NAME, LEVEL_ABBR
-- GLOBALS: ZONE, FACTION, FRIENDS, GAME

local friendsTablets = LibStub("Tablet-2.0")
local FriendsTabletData = {}
IF.FriendsTabletDataNames = {}
local FriendsOnline = 0
local displayString = string.join("", "%s: ", "", "%d|r")
local FriendsCat
local resSizeExtra

local ClassLookup = {}
for k, v in pairs(LOCALIZED_CLASS_NAMES_MALE) do
    ClassLookup[v] = k
end
for k, v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do
    ClassLookup[v] = k
end

local function Friends_TabletClickFunc(name, iname, toonid)
    if not name then return end
    if IsAltKeyDown() then
        if toonid then
            BNInviteFriend(toonid)
        elseif iname == "" then
            InviteUnit(name)
        else
            InviteUnit(iname)
        end
    else
        if toonid then
            ChatFrame_SendSmartTell(name, DEFAULT_CHAT_FRAME)
        else
            ChatFrame_SendTell(name, DEFAULT_CHAT_FRAME)
        end
    end
end

local function Friends_BuildTablet()
{'fraction_non_alphanumeric': 0.06701680672268907, 'fraction_numerical': 0.0016806722689075631, 'mean_word_length': 4.568421052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6538328', 'n_tokens_mistral': 1549, 'n_tokens_neox': 1512, 'n_words': 411}