From e587c80b0edad800d47cd4efcb40610296011de1 Mon Sep 17 00:00:00 2001 From: kalrnlo Date: Thu, 25 Jul 2024 21:53:34 -0600 Subject: [PATCH] Update docs, and improve docs for retryer and race --- docs/character.md | 4 +++ docs/grouper.md | 8 ++++-- docs/index.md | 6 ++-- docs/is-empty.md | 3 ++ docs/leventine.md | 3 ++ docs/linked-list.md | 3 ++ docs/log-analytics.md | 4 +++ docs/player-zone.md | 4 +++ docs/race.md | 7 ++--- docs/random.md | 6 ++++ docs/ratelimit.md | 4 +++ docs/rbx-thumb.md | 4 +++ docs/retryer.md | 67 ++++++++++++++++++++++++++++++++++--------- docs/safe-teleport.md | 6 ++++ docs/text-chat.md | 5 +++- docs/url.md | 5 +++- 16 files changed, 113 insertions(+), 26 deletions(-) diff --git a/docs/character.md b/docs/character.md index e69de29..6901f8a 100644 --- a/docs/character.md +++ b/docs/character.md @@ -0,0 +1,4 @@ +# Character + +> [!INFO] +> The docs for this library are incomplete \ No newline at end of file diff --git a/docs/grouper.md b/docs/grouper.md index 3b52e8a..4ac1a9b 100644 --- a/docs/grouper.md +++ b/docs/grouper.md @@ -1,8 +1,10 @@ -### Grouper +# Grouper A module for getting accurate group ranks for players on the server, and detecting rank changes -#### example +> [!WARNING] +> The docs for this library are outdated, but are mostly correct + ```luau local text_chat_service = game:GetService("TextChatService") local players = game:GetService("Players") @@ -23,7 +25,7 @@ local group_channels = { [4] = create_text_channel("barista"), } -grouper.init({ +grouper.init.server({ -- how often in seconds grouper should check to see if a players rank has changed rank_refresh_rate = 60, -- the groupid for the group grouper checks ranks for diff --git a/docs/index.md b/docs/index.md index f937f9c..628e5a1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -26,7 +26,7 @@ features: link: /linked-list - icon: 📊 title: Log Analytics - details: a wrapper around roblox's AnalyticsService with a better api + details: A wrapper around roblox's AnalyticsService with a better api link: /log-analytics - icon: 👁️ title: Observer @@ -50,11 +50,11 @@ features: link: /ratelimit - icon: 🖼️ title: RbxThumb - details: a utility for making roblox thumbnail urls + details: A utility for making roblox thumbnail urls link: /rbx-thumb - icon: 🔁 title: Retryer - details: a simple utility for easily retrying functions + details: A simple utility for easily retrying functions link: /retryer - icon: 🛸 title: Safe Teleport diff --git a/docs/is-empty.md b/docs/is-empty.md index e69de29..1fbbf07 100644 --- a/docs/is-empty.md +++ b/docs/is-empty.md @@ -0,0 +1,3 @@ +# Linked List + +A doubly-linked list implementation in luau diff --git a/docs/leventine.md b/docs/leventine.md index e69de29..1fbbf07 100644 --- a/docs/leventine.md +++ b/docs/leventine.md @@ -0,0 +1,3 @@ +# Linked List + +A doubly-linked list implementation in luau diff --git a/docs/linked-list.md b/docs/linked-list.md index e69de29..1fbbf07 100644 --- a/docs/linked-list.md +++ b/docs/linked-list.md @@ -0,0 +1,3 @@ +# Linked List + +A doubly-linked list implementation in luau diff --git a/docs/log-analytics.md b/docs/log-analytics.md index e69de29..c93e5d6 100644 --- a/docs/log-analytics.md +++ b/docs/log-analytics.md @@ -0,0 +1,4 @@ +# Log Analytics + +> [!INFO] +> The docs for this library are incomplete \ No newline at end of file diff --git a/docs/player-zone.md b/docs/player-zone.md index e69de29..897de78 100644 --- a/docs/player-zone.md +++ b/docs/player-zone.md @@ -0,0 +1,4 @@ +# Player Zone + +> [!INFO] +> The docs for this library are incomplete \ No newline at end of file diff --git a/docs/race.md b/docs/race.md index e5b1c09..3e09dbe 100644 --- a/docs/race.md +++ b/docs/race.md @@ -1,9 +1,7 @@ -### Race +# Race -utility function for getting the return from the first function -in an array to return +Runs several functions at once, and returns the result of the function that completes first -#### example ```luau local task = require("@lune/task") local race = require("race") @@ -20,5 +18,4 @@ local result = race({ }) print(result) -- "i return!" - ``` diff --git a/docs/random.md b/docs/random.md index e69de29..deb6146 100644 --- a/docs/random.md +++ b/docs/random.md @@ -0,0 +1,6 @@ +# Random + +A implementation of robloxs random class in pure luau + +> [!INFO] +> The docs for this library are incomplete \ No newline at end of file diff --git a/docs/ratelimit.md b/docs/ratelimit.md index e69de29..81cd206 100644 --- a/docs/ratelimit.md +++ b/docs/ratelimit.md @@ -0,0 +1,4 @@ +# Ratelimit + +> [!INFO] +> The docs for this library are incomplete diff --git a/docs/rbx-thumb.md b/docs/rbx-thumb.md index e69de29..b3a0f06 100644 --- a/docs/rbx-thumb.md +++ b/docs/rbx-thumb.md @@ -0,0 +1,4 @@ + + +> [!INFO] +> The docs for this library are incomplete \ No newline at end of file diff --git a/docs/retryer.md b/docs/retryer.md index 6d5ecb3..5cc1b28 100644 --- a/docs/retryer.md +++ b/docs/retryer.md @@ -1,27 +1,68 @@ -### Retryer +# Retryer -Module for easily retrying functions +A utility for easily retrying functions -#### example ```luau local StarterGui = game:GetService("StarterGui") local retryer = require("retryer") -local SET_CORE = StarterGui.SetCore +retryer.inf(10, StarterGui.SetCore, "ResetButtonCallback", false) -local function foo(n: number) - return n + 1 -end +``` --- delay between retrys, max retrys, function to retry, function args -local success, added = retryer.delay(10, 20, foo, 1) +## Methods + +### `__call` + +Retrys a function x times, based on how many retries its allowed to make +```luau -- max retrys, function to retry, function args -local success, other_added = retryer(20, foo, 1) +local success, added = retryer(20, function(n: number) + return n + 3 +end, 1) + +other_added -= 3 +``` + +### `delay` + +Retrys a function x times, based on how many retries its allowed to make. +With a delay in between thats provided as the first argument + +```luau +-- delay between retrys, max retrys, function to retry, function args +local success, added = retryer.delay(20, 10, function(n: number) + return n + 3 +end, 1) + other_added -= 3 +``` + +> [!DANGER] +> The infinite methods can infinitely yield so its reccomened to not use them unless you have to +> such as with [`StarterGui:SetCore()`](https://create.roblox.com/docs/reference/engine/classes/StarterGui#SetCore) + +### `inf` + +Works like [`__call`](#call), except that it infinitely retries until it succeeds + +```luau +-- function to retry, function args +local added = retryer(function(n: number) + return n + 3 +end, 1) + +other_added -= 3 +``` --- infretry is useful for stuff like StarterGui:SetCore() --- where it will fail for a bit unless ur script is parented to StarterGui -retryer.infretry(SET_CORE, "ResetButtonCallback", false) +### `infdelay` +Works like [`delay`](#delay), except that it infinitely retries until it succeeds + +```luau +local StarterGui = game:GetService("StarterGui") + +retryer.infdelay(10, StarterGui.SetCore, "ResetButtonCallback", false) ``` + diff --git a/docs/safe-teleport.md b/docs/safe-teleport.md index e69de29..5acf6fe 100644 --- a/docs/safe-teleport.md +++ b/docs/safe-teleport.md @@ -0,0 +1,6 @@ +# Safe Teleport + +A teleport async wrapper that makes teleporting simple + +> [!INFO] +> The docs for this library are incomplete \ No newline at end of file diff --git a/docs/text-chat.md b/docs/text-chat.md index 21c7de8..0046d45 100644 --- a/docs/text-chat.md +++ b/docs/text-chat.md @@ -1 +1,4 @@ -lol \ No newline at end of file +# Text Chat + +> [!INFO] +> The docs for this library are incomplete \ No newline at end of file diff --git a/docs/url.md b/docs/url.md index 21c7de8..9962508 100644 --- a/docs/url.md +++ b/docs/url.md @@ -1 +1,4 @@ -lol \ No newline at end of file +# Url + +> [!INFO] +> The docs for this library are incomplete \ No newline at end of file