[LUA] Get Identities

Bluscream

Retired Staff
Contributor
May 8, 2015
967
934
211
This is some PoC code to get the current users identities in LUA, it will be included in my later released LUA API:

Code:
function getIDList()
    local open = io.open
    local filnam = ts3.getConfigPath().."ts3clientui_qt.secrets.conf"
    local filnam = string.gsub(filnam, "\\", "\\\\")
    local file = open(filnam, "r")
    id_list = {}
     for line in file:lines() do
        if string.find(line, '/id=') then
            local line = ""..string.gsub(line, "%d+/id=", "")
            local line = ""..string.gsub(line, "%%20", " ")
            table.insert(id_list, line)
        end
     end
    file:close()
    ts3.printMessageToCurrentTab("Length: "..#id_list)
end
Code:
function printID(scHID, id)
    getIDList()
    ts3.printMessageToCurrentTab(id_list[id])
end

function printIDs()
    getIDList()
    str = ""
    for i=1, #id_list do
        str = str..id_list[i]..", "
    end
    ts3.printMessageToCurrentTab(str)
    str = nil;
end
 
Top