Skip to content

Commit

Permalink
Update docs, and improve docs for retryer and race
Browse files Browse the repository at this point in the history
  • Loading branch information
gaymeowing committed Jul 26, 2024
1 parent 39b7d6c commit e587c80
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 26 deletions.
4 changes: 4 additions & 0 deletions docs/character.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Character

> [!INFO]
> The docs for this library are incomplete
8 changes: 5 additions & 3 deletions docs/grouper.md
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions docs/is-empty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Linked List

A doubly-linked list implementation in luau
3 changes: 3 additions & 0 deletions docs/leventine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Linked List

A doubly-linked list implementation in luau
3 changes: 3 additions & 0 deletions docs/linked-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Linked List

A doubly-linked list implementation in luau
4 changes: 4 additions & 0 deletions docs/log-analytics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Log Analytics

> [!INFO]
> The docs for this library are incomplete
4 changes: 4 additions & 0 deletions docs/player-zone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Player Zone

> [!INFO]
> The docs for this library are incomplete
7 changes: 2 additions & 5 deletions docs/race.md
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -20,5 +18,4 @@ local result = race({
})
print(result) -- "i return!"
```
6 changes: 6 additions & 0 deletions docs/random.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Random

A implementation of robloxs random class in pure luau

> [!INFO]
> The docs for this library are incomplete
4 changes: 4 additions & 0 deletions docs/ratelimit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ratelimit

> [!INFO]
> The docs for this library are incomplete
4 changes: 4 additions & 0 deletions docs/rbx-thumb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


> [!INFO]
> The docs for this library are incomplete
67 changes: 54 additions & 13 deletions docs/retryer.md
Original file line number Diff line number Diff line change
@@ -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)
```

6 changes: 6 additions & 0 deletions docs/safe-teleport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Safe Teleport

A teleport async wrapper that makes teleporting simple

> [!INFO]
> The docs for this library are incomplete
5 changes: 4 additions & 1 deletion docs/text-chat.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
lol
# Text Chat

> [!INFO]
> The docs for this library are incomplete
5 changes: 4 additions & 1 deletion docs/url.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
lol
# Url

> [!INFO]
> The docs for this library are incomplete

0 comments on commit e587c80

Please sign in to comment.