Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Datastore] [Edited] GetCurrentPage returns table?

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.