Okay so. I have been working on a admin software, which uses custom accounts to access databases and manage these.
When a player logs into a database account, the system needs to fetch all the databases this account is a member of. I wrote a little script to do that, but it literally takes 38 seconds, just to go trough all this and register one database in the UI. Is there any way to make it more efficent / quicker?
The code:
for i = 1, #boards do
for i = 1, #DBInfo do
local exact = DBInfo[i]:split(",")
if boards[i] == exact[1] then
local Accounts = API:GetListID("Accounts", exact[2])
local Accounts1 = API:GetCardsInList(Accounts)
for i = 1, #Accounts1 do
if Accounts1[i].name == account.name then
rankinfo = Accounts1[i].desc
end
end
local Classlist = API:GetListID("Classes", exact[2])
local Classes = API:GetCardsInList(Classlist)
for i = 1, #Classes do
local rankid = Classes[i].desc:split("|")
if rankinfo == rankid[1] then
local DBSetList = API:GetListID("DBSettings", exact[2])
local DBSettings = API:GetCardsInList(DBSetList)
local DBSetCard = DBSettings[1]
local DBSetDesc = DBSetCard.desc:split("|")
local DBIcon = DBSetDesc[2]
local rank = Classes[i].name
local DBName = DBSetDesc[3]
if lastrun ~= DBName then
local rdata = {}
rdata[1] = DBName
rdata[2] = DBIcon
rdata[3] = rank
local response = "createdbcard"
event2:FireClient(player, response, rdata)
lastrun = DBName
end
end
end
end
end
end