Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Datastore] [Edited] GetCurrentPage returns table?

Asked by 9 years ago

I looked in the wiki and I found it returns Array, but that doesnt help.. :/

Output(5,Plr,'Datastored_Nil_Logs','White',function()
    local _NilLogs={}
    local CData=DS:GetOrderedDataStore('TestGravityNilLogs'):GetSortedAsync(false, 10)
    local COutput=CData:GetCurrentPage()

    for a,b in pairs(COutput) do   -- The script skips this? dahell....
       local plr=b.key
       local num=b.value
       table.insert(_NilLogs,{Num=num,Player=plr})
   end

    Output(5,Plr,'Showing Top 10 Data\'s','Really blue',function() end)
    for _,v in pairs(_NilLogs) do
        Output(5,Plr,'Showing Top 10 Data\'s','Really blue',function() end)
        Output(20,Plr,'Name : '..v.Player,'White',function()
            Dismiss(Plr)
            Output(20,Plr,'Name : '..v.Player,'White',function() end)
            Output(20,Plr,'Dismiss','Lime green',function() Dismiss(Plr) end)
        end)
    end
end)

1 answer

Log in to vote
0
Answered by 9 years ago

The key is a member of the tables value and not the index.

There are multiple useful examples found Here

local CData=DS:GetOrderedDataStore('TestGravityNilLogs'):GetSortedAsync(false, 10)

local COutput=CData:GetCurrentPage()  -- error here? (Idk)

    for a,b in pairs(COutput) do
       local plr=b.key
       local num=b.value
       table.insert(Gravity_V4._Nils,{Num=num,Player=plr})
   end
Ad

Answer this question