diff --git a/modules/buffer-util/BufferReader.luau b/modules/buffer-util/BufferReader.luau index 59c18be2..4c43e0ed 100644 --- a/modules/buffer-util/BufferReader.luau +++ b/modules/buffer-util/BufferReader.luau @@ -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() @@ -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)) diff --git a/modules/buffer-util/BufferWriter.luau b/modules/buffer-util/BufferWriter.luau index 9f428015..9c59d865 100644 --- a/modules/buffer-util/BufferWriter.luau +++ b/modules/buffer-util/BufferWriter.luau @@ -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 @@ -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 diff --git a/modules/input/Mouse.luau b/modules/input/Mouse.luau index 43beb5c9..45903c6f 100644 --- a/modules/input/Mouse.luau +++ b/modules/input/Mouse.luau @@ -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() @@ -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 @@ -262,6 +264,7 @@ end :::caution Must explicitly unlock See cautionary in `Lock` method above. + ::: ]=] function Mouse:LockCenter() UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter diff --git a/modules/pid/init.luau b/modules/pid/init.luau index c34a46e0..20344a4f 100644 --- a/modules/pid/init.luau +++ b/modules/pid/init.luau @@ -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 diff --git a/modules/quaternion/init.luau b/modules/quaternion/init.luau index ca44b3b0..a871fa47 100644 --- a/modules/quaternion/init.luau +++ b/modules/quaternion/init.luau @@ -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({ diff --git a/modules/table-util/init.luau b/modules/table-util/init.luau index 77e410b1..dbfa656f 100644 --- a/modules/table-util/init.luau +++ b/modules/table-util/init.luau @@ -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 = {} @@ -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, deep: boolean?): T if not deep then @@ -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(srcTbl: S, templateTbl: T): T assert(type(srcTbl) == "table", "First argument must be a table") @@ -205,6 +208,7 @@ end :::note Arrays only This function works on arrays, but not dictionaries. + ::: ]=] local function SwapRemove(t: { T }, i: number) local n = #t @@ -230,6 +234,7 @@ end :::note Arrays only This function works on arrays, but not dictionaries. + ::: ]=] local function SwapRemoveFirstValue(t: { T }, v: T): number? local index: number? = table.find(t, v) @@ -403,6 +408,7 @@ end :::note Arrays only This function works on arrays, but not dictionaries. + ::: ]=] local function Extend(target: { T }, extension: { E }): { T } & { E } local tbl = table.clone(target) :: { any } @@ -428,6 +434,7 @@ end :::note Arrays only This function works on arrays, but not dictionaries. + ::: ]=] local function Reverse(tbl: { T }): { T } local n = #tbl @@ -455,6 +462,7 @@ end :::note Arrays only This function works on arrays, but not dictionaries. + ::: ]=] local function Shuffle(tbl: { T }, rngOverride: Random?): { T } assert(type(tbl) == "table", "First argument must be a table") @@ -485,6 +493,7 @@ end :::note Arrays only This function works on arrays, but not dictionaries. + ::: ]=] local function Sample(tbl: { T }, size: number, rngOverride: Random?): { T } assert(type(tbl) == "table", "First argument must be a table") @@ -533,6 +542,7 @@ end :::note Arrays only This function works on arrays, but not dictionaries. + ::: ]=] local function Flat(tbl: { T }, depth: number?): { T } local maxDepth: number = if type(depth) == "number" then depth else 1 @@ -570,6 +580,7 @@ end :::note Arrays only This function works on arrays, but not dictionaries. + ::: ]=] local function FlatMap(tbl: { T }, callback: (T, number, { T }) -> M): { M } return Flat(Map(tbl, callback)) @@ -596,6 +607,7 @@ end local keys = TableUtil.Keys(t) table.sort(keys) ``` + ::: ]=] local function Keys(tbl: { [K]: V }): { K } local keys = table.create(#tbl) @@ -626,6 +638,7 @@ end local values = TableUtil.Values(t) table.sort(values) ``` + ::: ]=] local function Values(tbl: { [K]: V }): { V } local values = table.create(#tbl) @@ -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(tbl: { [K]: V }, callback: (V, K, { [K]: V }) -> boolean): (V?, K?) for k, v in tbl do