Introduction to Pages
Pages are object oriented arrays that represent part of the web API. They're only on specific endpoints that do not have a finite limit like the past usernames of users, followers, etc. These are used similarly with OrderedDatastores if you've ever used those.
They have three methods and are resource-intensive (http-wise) if you're trying to spam go through all pages of an object.
:getCurrentPage
This method returns an <array> that's the currently selected page.
pageObj:getCurrentPage() --> This method does not need a promise as it returns whatever page is already selected
:getPreviousPage
This method returns an <array> that's the previous page selected.
If it reaches page 1, it will just keep returning that page instead of returning "nil".
pageObj:getPreviousPage() --> This method does not need a promise as it returns whatever page is already cached
:advanceToNextPage
This method returns a <promise> for proceeding to the next page. If there's no more pages, it will reject with "[No next page found]".
pageObj:advanceToNextPage():andThen(function(nextPage)
print(nextPage,"loaded");
end):catch(function(err)
warn(err);
end)
Last updated