Skip to content

Commit

Permalink
Fix Admonitions
Browse files Browse the repository at this point in the history
  • Loading branch information
YetAnotherClown committed Dec 10, 2024
1 parent ca9ffa0 commit eebba71
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/buffer-util/BufferReader.luau
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ end
:::info
This assumes the string was written using the `BufferWriter:WriteString()`
method, which stores an extra integer to mark the size of the string.
:::
]=]
function BufferReader:ReadString(): string
local strLen = self:ReadUInt32()
Expand All @@ -153,6 +154,7 @@ end
:::info
This assumes the string was written using the `BufferWriter:WriteStringRaw()`.
:::
]=]
function BufferReader:ReadStringRaw(length: number): string
length = math.max(0, math.floor(length))
Expand Down
2 changes: 2 additions & 0 deletions modules/buffer-util/BufferWriter.luau
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ end
An extra 32-bit integer is stored before the string to mark the
length of the string. If the length of the string is always
known, it is more memory-efficient to use `WriteStringRaw`.
:::
]=]
function BufferWriter:WriteString(str: string, length: number?)
local len = if length then math.min(#str, length) else #str
Expand All @@ -161,6 +162,7 @@ end
read this string from the buffer, as the length of the string is
not stored in the buffer. For strings of dynamic/unknown length,
use `WriteString` instead.
:::
]=]
function BufferWriter:WriteStringRaw(str: string, length: number?)
local len = if length then math.min(#str, length) else #str
Expand Down
3 changes: 3 additions & 0 deletions modules/input/Mouse.luau
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ end
Getting the mouse delta is only intended for when the mouse is locked. If the
mouse is _not_ locked, this will return a zero Vector2. The mouse can be locked
using the `mouse:Lock()` and `mouse:LockCenter()` method.
:::
]=]
function Mouse:GetDelta(): Vector2
return UserInputService:GetMouseDelta()
Expand Down Expand Up @@ -251,6 +252,7 @@ end
Be sure to explicitly call `mouse:Unlock()` before cleaning up the mouse.
The `Destroy` method does _not_ unlock the mouse since there is no way
to guarantee who "owns" the mouse lock.
:::
]=]
function Mouse:Lock()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
Expand All @@ -262,6 +264,7 @@ end
:::caution Must explicitly unlock
See cautionary in `Lock` method above.
:::
]=]
function Mouse:LockCenter()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
Expand Down
1 change: 1 addition & 0 deletions modules/pid/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ end
:::info Studio Only
This will only create the folder in Studio. In a real game server,
this function will do nothing.
:::
]=]
function PID:Debug(name: string, parent: Instance?)
if not game:GetService("RunService"):IsStudio() then
Expand Down
1 change: 1 addition & 0 deletions modules/quaternion/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Quaternion.__index = Quaternion
:::caution
The `new` constructor assumes the given arguments represent a proper Quaternion. This
constructor should only be used if you really know what you're doing.
:::
]=]
function Quaternion.new(x: number, y: number, z: number, w: number): Quaternion
local self = setmetatable({
Expand Down
14 changes: 14 additions & 0 deletions modules/table-util/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:::info Immutability
All functions (_except_ `SwapRemove`, `SwapRemoveFirstValue`, and `Lock`) treat tables as immutable and will return
copies of the given table(s) with the operations performed on the copies.
:::
]=]
local TableUtil = {}

Expand All @@ -36,6 +37,7 @@ local rng = Random.new()
Deep copies are _not_ protected against cyclical references. Passing
a table with cyclical references _and_ the `deep` parameter set to
`true` will result in a stack-overflow.
:::
]=]
local function Copy<T>(t: T, deep: boolean?): T
if not deep then
Expand Down Expand Up @@ -80,6 +82,7 @@ end
be dynamic data added that isn't in the template.
For player data, use `TableUtil.Reconcile` instead.
:::
]=]
local function Sync<S, T>(srcTbl: S, templateTbl: T): T
assert(type(srcTbl) == "table", "First argument must be a table")
Expand Down Expand Up @@ -205,6 +208,7 @@ end
:::note Arrays only
This function works on arrays, but not dictionaries.
:::
]=]
local function SwapRemove<T>(t: { T }, i: number)
local n = #t
Expand All @@ -230,6 +234,7 @@ end
:::note Arrays only
This function works on arrays, but not dictionaries.
:::
]=]
local function SwapRemoveFirstValue<T>(t: { T }, v: T): number?
local index: number? = table.find(t, v)
Expand Down Expand Up @@ -403,6 +408,7 @@ end
:::note Arrays only
This function works on arrays, but not dictionaries.
:::
]=]
local function Extend<T, E>(target: { T }, extension: { E }): { T } & { E }
local tbl = table.clone(target) :: { any }
Expand All @@ -428,6 +434,7 @@ end
:::note Arrays only
This function works on arrays, but not dictionaries.
:::
]=]
local function Reverse<T>(tbl: { T }): { T }
local n = #tbl
Expand Down Expand Up @@ -455,6 +462,7 @@ end
:::note Arrays only
This function works on arrays, but not dictionaries.
:::
]=]
local function Shuffle<T>(tbl: { T }, rngOverride: Random?): { T }
assert(type(tbl) == "table", "First argument must be a table")
Expand Down Expand Up @@ -485,6 +493,7 @@ end
:::note Arrays only
This function works on arrays, but not dictionaries.
:::
]=]
local function Sample<T>(tbl: { T }, size: number, rngOverride: Random?): { T }
assert(type(tbl) == "table", "First argument must be a table")
Expand Down Expand Up @@ -533,6 +542,7 @@ end
:::note Arrays only
This function works on arrays, but not dictionaries.
:::
]=]
local function Flat<T>(tbl: { T }, depth: number?): { T }
local maxDepth: number = if type(depth) == "number" then depth else 1
Expand Down Expand Up @@ -570,6 +580,7 @@ end
:::note Arrays only
This function works on arrays, but not dictionaries.
:::
]=]
local function FlatMap<T, M>(tbl: { T }, callback: (T, number, { T }) -> M): { M }
return Flat(Map(tbl, callback))
Expand All @@ -596,6 +607,7 @@ end
local keys = TableUtil.Keys(t)
table.sort(keys)
```
:::
]=]
local function Keys<K, V>(tbl: { [K]: V }): { K }
local keys = table.create(#tbl)
Expand Down Expand Up @@ -626,6 +638,7 @@ end
local values = TableUtil.Values(t)
table.sort(values)
```
:::
]=]
local function Values<K, V>(tbl: { [K]: V }): { V }
local values = table.create(#tbl)
Expand Down Expand Up @@ -665,6 +678,7 @@ end
While `Find` can also be used with dictionaries, dictionary ordering is never
guaranteed, and thus the result could be different if there are more
than one possible matches given the data and callback function.
:::
]=]
local function Find<K, V>(tbl: { [K]: V }, callback: (V, K, { [K]: V }) -> boolean): (V?, K?)
for k, v in tbl do
Expand Down

0 comments on commit eebba71

Please sign in to comment.