repo
stringclasses
341 values
file_path
stringlengths
29
173
language
stringclasses
2 values
file_type
stringclasses
4 values
code
stringlengths
2
1.66M
tokens
int64
2
598k
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/cubemaps/flatday/flatday.luau
luau
.luau
--!strict --!native local B64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAFDmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9...
1,718
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/cubemaps/flatday/flatday_bk.luau
luau
.luau
--!strict --!native return require( "./flatday" )
16
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/cubemaps/zero/zero.luau
luau
.luau
--!strict --!native local B64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAFDmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9...
1,728
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/cubemaps/zero/zero_bk.luau
luau
.luau
--!strict --!native return require( "./zero" )
15
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/font_codepage437.luau
luau
.luau
--!strict --!native local B64 = "iVBORw0KGgoAAAANSUhEUgAACQAAAAAOCAIAAAD1rrSwAAAACXBIWXMAAAsTAAALEwEAmpwYAAAPBklEQVR4nO1dW5IjsarUOXHX6EV6lefDcStoHslD1MMe8qOjuiRQCiFAsnvmP+tH8X6/1fev16tdajB4Gj6ePH47GAwGA4r3+51NDZNQBoPBP4XjPKjGvQmJgxSoO43zYNAS5Xj+PKg/F7Hq8UzNCwxeaGIj7q8jUFgbq6ywNqOaeWsKe2lcafmLpZ7gvYDGxWMVDKsCaKBSwW4YkyA...
3,755
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/init.luau
luau
.luau
--!strict --!native --[[ Penumbra: textures.luau This module handles loading and processing a texture via any of the given load parameters by the calling module. Assets are stored via textures/assets, additional ones can be added by providing PNG files as base64-encoded strings so that no filesystem dependen...
4,127
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/types.luau
luau
.luau
-- Types : Textures -- -- Represents what constitutes as a texture. export type Texture = { [number]: vector, read Buffer: buffer, read Dimensions: vector, read Width: number, read Height: number, read Width0: number, read Height0: number, read FD: vector, read Mult: vector | number } -- A super...
164
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/license/base64.luau
luau
.luau
--[[ MIT License Copyright (c) 2025 daily3014 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, di...
223
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/license/penumbra.luau
luau
.luau
--[[ The MIT License (MIT) Copyright (c) 2026 Crazyblox Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
226
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/license/png.luau
luau
.luau
--[[ The MIT License (MIT) Copyright (c) 2024 sircfenner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, ...
227
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/.lune/.typedefs/fs.luau
luau
.luau
--#selene: allow(unused_variable) export type MetadataKind = "file" | "dir" | "symlink" --[=[ @interface MetadataPermissions @within FS Permissions for the given file or directory. This is a dictionary that will contain the following values: * `readOnly` - If the target path is read-only or not ]=] export typ...
1,777
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/.lune/test.luau
luau
.luau
--!strict --#selene: allow(incorrect_standard_library_use) -- This is kind of a nightmare, but it gives intellisense without -- having to disable type checking. type Fs = typeof(require(".lune/.typedefs/fs")) type Process = typeof(require(".lune/.typedefs/process")) local fs = (require :: any)("@lune/fs") :: Fs local...
472
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/blake2b/init.luau
luau
.luau
--!strict --!native --!optimize 2 --- The front half of the initial values used for the hasher state. local IV_FRONT = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 } --- The back half of the initial values used for the hasher state. local IV_BACK = { 0xf3bcc908, 0x84...
9,500
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/blake2s/init.luau
luau
.luau
--!strict --!native --!optimize 2 --- The initial values used for the hasher state. local IV = { 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 } --- A list of offsets to use for each round in the compression algorithm. local SIGMA = { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
3,317
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/md5/init.luau
luau
.luau
--!strict --!native --!optimize 2 --- Precomputed MD5 constants. You may compute these manually --- with `floor(2^32 * abs(sin(i + 1)))` from 0 to 63. --stylua: ignore local K = { 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5...
2,072
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/sha1/init.luau
luau
.luau
--!strict --!native --!optimize 2 --- An allocation that is reused for blocks during hashing local BLOCK = table.create(80) --[=[ Processes `message` from byte `start` to byte `finish` using `digest`. It is assumed that `(finish - start) % 64 == 0`. ]=] local function processBlocks(digest: { number }, message: stri...
1,483
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/sha224/init.luau
luau
.luau
--!strict --!native --!optimize 2 --stylua: ignore local K = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2d...
2,073
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/sha256/init.luau
luau
.luau
--!strict --!native --!optimize 2 --stylua: ignore local K = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2d...
2,081
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/sha384/init.luau
luau
.luau
--!strict --!native --!optimize 2 local BLOCK_FRONT = table.create(80) local BLOCK_BACK = table.create(80) --stylua: ignore local K_FRONT = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80de...
5,398
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/sha512/init.luau
luau
.luau
--!strict --!native --!optimize 2 local BLOCK_FRONT = table.create(80) local BLOCK_BACK = table.create(80) --stylua: ignore local K_FRONT = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80de...
5,444
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/modules/xxhash32/init.luau
luau
.luau
--!strict --!native --!optimize 2 local PRIME_1 = 0x9e3779B1 local PRIME_2 = 0x85ebca77 local PRIME_3 = 0xc2B2ae3d local PRIME_4 = 0x27d4eb2f local PRIME_5 = 0x165667b1 --[=[ Calculates `a * b` mod 32 ]=] local function mult(a: number, b: number): number local ah, al = bit32.rshift(a, 16), a % 2 ^ 16 local bh, ...
1,139
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/blake2b.luau
luau
.luau
local blake2b = require("../modules/blake2b") local t = os.clock() local startgc = gcinfo() assert( blake2b("abc", 64) == "ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923", "(BLAKE2b) abc hash does not match" ) --stylua: ignore sta...
5,440
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/blake2s.luau
luau
.luau
local blake2s = require("../modules/blake2s") local t = os.clock() local startgc = gcinfo() assert( blake2s("abc", 32) == "508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982", "(BLAKE2s) abc hash does not match" ) assert( blake2s("abc", 32, "508c5e8c327c14e2e1a72ba34eeb452f") == "1e3ed5414ca157217c...
2,654
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/md5.luau
luau
.luau
local md5 = require("../modules/md5") local t = os.clock() local startgc = gcinfo() local hash, digest = md5("abc") assert(hash == "900150983cd24fb0d6963f7d28e17f72", "(MD5) abc hash does not match") assert(digest[1] == 0x90015098, "(MD5) first word of abc hash was incorrect") assert(digest[2] == 0x3cd24fb0, "(MD5) s...
997
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/sha1.luau
luau
.luau
local sha1 = require("../modules/sha1") local t = os.clock() local startgc = gcinfo() local hash, digest = sha1("abc") assert(hash == "a9993e364706816aba3e25717850c26c9cd0d89d", "(SHA-1) abc hash does not match") assert(digest[1] == 0xa9993e36, "(SHA-1) first word of abc hash was incorrect") assert(digest[2] == 0x470...
1,120
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/sha224.luau
luau
.luau
local sha224 = require("../modules/sha224") local t = os.clock() local startgc = gcinfo() local hash, digest = sha224("abc") assert(hash == "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "(SHA-224) abc hash does not match") assert(digest[1] == 0x23097d22, "(SHA-224) first word of abc hash was incorrect")...
1,303
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/sha256.luau
luau
.luau
local sha256 = require("../modules/sha256") local t = os.clock() local startgc = gcinfo() local hash, digest = sha256("abc") assert(hash == "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "(SHA-256) abc hash does not match") assert(digest[1] == 0xba7816bf, "(SHA-256) first word of abc hash was inc...
1,376
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/sha384.luau
luau
.luau
local sha384 = require("../modules/sha384") local t = os.clock() local startgc = gcinfo() local hash, digest = sha384("abc") assert( hash == "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7", "(SHA-384) abc hash does not match" ) assert(digest[1] == 0xcb00753f, "(SHA...
1,890
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/sha512.luau
luau
.luau
local sha512 = require("../modules/sha512") local t = os.clock() local startgc = gcinfo() local hash, digest = sha512("abc") assert( hash == "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", "(SHA-512) abc hash does not match" ) ass...
2,172
Dekkonot/luau-hashing
Dekkonot-luau-hashing-81061a4/tests/xxhash32.luau
luau
.luau
local xxhash32 = require("../modules/xxhash32") local t = os.clock() local startgc = gcinfo() assert(xxhash32("abc") == 0x32d153ff, "(XXH32) abc hash does not match") -- 852579327 assert(xxhash32("abc", 0x32d153ff) == 0x9041e0d8, "(XXH32) abc hash with seed does not match") assert(xxhash32("") == 0x02cc5d05, "(XXH32...
1,057
Roblox/dash
Roblox-dash-5a885be/benchmark/benchmark.lua
luau
.lua
local Packages = game:GetService("ReplicatedStorage").Packages local JestGlobals = require(Packages.Dev.JestGlobals) local JestBenchmark = require(Packages.Dev.JestBenchmark) local describe = JestGlobals.describe local benchmark = JestBenchmark.benchmark return function<T>(name: string, times: number, benchFunction: (...
227
Roblox/dash
Roblox-dash-5a885be/benchmark/join.bench.lua
luau
.lua
local Packages = game:GetService("ReplicatedStorage").Packages local Dash = require(Packages.Dash) local Cryo = require(Packages.Dev.Cryo) local benchmark = require(script.Parent.benchmark) local DICT_A = { a = 5, b = 10, cherry = 800, } local DICT_B = { apple = 50, cherry = 80, fig = 100, } local DICT_C = { ba...
399
Roblox/dash
Roblox-dash-5a885be/benchmark/union.bench.lua
luau
.lua
local Packages = game:GetService("ReplicatedStorage").Packages local Dash = require(Packages.Dash) local Cryo = require(Packages.Dev.Cryo) local benchmark = require(script.Parent.benchmark) local DICT_A = { a = 5, b = 10, cherry = 800, } local DICT_B = { apple = 50, cherry = 80, fig = 100, } local BENCHMARK_ITE...
154
Roblox/dash
Roblox-dash-5a885be/src/Error.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) local class = require(Dash.class) local format = require(Dash.format) :: <T...>(string, T...) -> string local join = require(Dash.join) --[=[ Creates an error object with a specified name and message. In native Lua, errors can only be string values. At Ro...
421
Roblox/dash
Roblox-dash-5a885be/src/None.lua
luau
.lua
local Symbol = require(script.Parent.Symbol) local None = Symbol.new("None") --[=[ A symbol representing nothing, that can be used in place of nil as a key or value of a table, where nil is illegal. Utility functions can check for the None symbol and treat it like a nil value. @usage Use cases include: 1. Creat...
102
Roblox/dash
Roblox-dash-5a885be/src/Symbol.lua
luau
.lua
local Dash = script.Parent local class = require(Dash.class) --[=[ Creates a symbol with a specified name. Upper snake-case is recommended as the symbol is a constant, unless you are linking the symbol conceptually to a different string. Symbols are useful when you want a value that isn't equal to any other type, f...
266
Roblox/dash
Roblox-dash-5a885be/src/Types.lua
luau
.lua
-- A table with keys of type _Key_ and values of type _Value_ export type Map<Key, Value> = { [Key]: Value } -- A table with keys of a fixed type _Key_ and a boolean value representing membership of the set (default is false) export type Set<Key> = { [Key]: boolean } -- A table of any type export type Table = { [any]: ...
141
Roblox/dash
Roblox-dash-5a885be/src/all.lua
luau
.lua
type AllHandler = (any, any) -> boolean local defaultHandler: AllHandler = function(value) return value end --[=[ Returns `true` if all entries in the _input_ table satisfy the predicate _handler_. If no _handler_ is provided, the default predicate returns the truthiness of each value. For array inputs, elements...
186
Roblox/dash
Roblox-dash-5a885be/src/append.lua
luau
.lua
local Dash = script.Parent local None = require(Dash.None) local forEachArgs = require(Dash.forEachArgs) local forEach = require(Dash.forEach) local insert = table.insert --[=[ Adds new elements to the _target_ array from subsequent array arguments in left-to-right order. Arguments which are `nil` or `Dash.None` ar...
186
Roblox/dash
Roblox-dash-5a885be/src/assertEqual.lua
luau
.lua
local Dash = script.Parent --[=[ Performs a simple equality check and throws an error if _left_ is not equal to _right_. The formatted error message can be customized, which by default provides a serialization of both inputs using `Dash.pretty`. The `left` and `right` values are available to be referenced in the ...
183
Roblox/dash
Roblox-dash-5a885be/src/assign.lua
luau
.lua
local Dash = script.Parent local None = require(Dash.None) local Types = require(Dash.Types) local forEach = require(Dash.forEach) local forEachArgs = require(Dash.forEachArgs) --[=[ Adds new key/value pairs to the _target_ table from subsequent table arguments in left-to-right order. The `None` symbol can be used ...
470
Roblox/dash
Roblox-dash-5a885be/src/chain.lua
luau
.lua
-- TODO (AleksandrSl 18/08/2025): Implementation is valid, but it's impossible to cast nil into T... --!nocheck --[=[ Returns a stateful iterator that yields all elements from the first iterator, then the next, until exhausted. @param ... One or more stateful iterator functions to chain. @return A stateful iterator...
251
Roblox/dash
Roblox-dash-5a885be/src/class.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) local function throwNotImplemented(tags: Types.Table) local Error = require(Dash.Error) :: { [string]: any } -- see type Error local NotImplemented = Error.new("NotImplemented", [[The method "{methodName}" is not implemented on the class "{className}"]])...
2,163
Roblox/dash
Roblox-dash-5a885be/src/collect.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) -- TODO (AleksandrSl 18/08/2025): Try to type again with a solver V2. Solver V1 infers types weirdly, -- so the functions are barely usable without type casts export type CollectHandler<Key, Value, NewKey, NewValue> = (key: Key, value: Value) -> (NewKey?, N...
262
Roblox/dash
Roblox-dash-5a885be/src/collectArray.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) local insert = table.insert -- TODO (AleksandrSl 18/08/2025): Try to type again with a solver V2. Solver V1 infers types weirdly, -- so the functions are barely usable without type casts type CollectHandler<Key, Value, NewValue> = (key: Key, value: Value) ...
263
Roblox/dash
Roblox-dash-5a885be/src/collectSet.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) type CollectHandler<Key, Value, NewValue> = (key: Key, value: Value) -> NewValue? --[=[ Returns a new set built from iterating over _input_ and calling _handler_ for each `(key, value)`. If _handler_ is not provided, the values of _input_ are used direct...
293
Roblox/dash
Roblox-dash-5a885be/src/copy.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) --[=[ Returns a shallow copy of the _input_ table. Only the top level is copied; nested tables are copied by reference. @param input The table to copy. @return A new table with the same keys and values as _input_. @see `Dash.assign` to copy properties...
115
Roblox/dash
Roblox-dash-5a885be/src/count.lua
luau
.lua
type CountHandler<Key, Value> = (Value, Key) -> boolean local defaultHandler = function() return true end --[=[ Returns the number of elements in _input_, optionally counting only those for which _handler_ returns true on the `(value, key)` pair. If _handler_ is not provided, all elements are counted. Iteration o...
411
Roblox/dash
Roblox-dash-5a885be/src/cycles.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) local includes = require(Dash.includes) local keys = require(Dash.keys) local sort = table.sort export type Cycles = { -- A set of tables which were visited recursively visited: Types.Set<Types.Table>, -- A map from table to unique index in visit order ...
808
Roblox/dash
Roblox-dash-5a885be/src/debounce.lua
luau
.lua
local Dash = script.Parent local assign = require(Dash.assign) type DebounceOptions = { leading: boolean?, trailing: boolean?, } type DebounceOptionsInternal = { leading: boolean, trailing: boolean, } -- `& (...any) -> ...any` in the function type is a funky way to mimick `T extends function` type AnyVoidFunctio...
597
Roblox/dash
Roblox-dash-5a885be/src/endsWith.lua
luau
.lua
--[=[ Checks whether _input_ ends with the string _suffix_. @return `true` if _input_ ends with _suffix_; otherwise `false`. @example ```luau endsWith("Fun Roblox Games", "Games") --> true ``` @example ```luau endsWith("Bad Roblox Memes", "Games") --> false ``` ]=] local function endsWith(input: string, suff...
118
Roblox/dash
Roblox-dash-5a885be/src/filter.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) export type FilterHandler<Key, Value> = (Value, Key) -> boolean --[=[ Returns a new array containing the elements of the _input_ table for which _handler_ returns truthy. For an array input, the order of elements is preserved in the output. For a Map/ta...
195
Roblox/dash
Roblox-dash-5a885be/src/find.lua
luau
.lua
export type FindHandler<Key, Value> = (Value, Key) -> boolean --[=[ Returns the first element in the _input_ table that satisfies the _handler_ predicate. For an array input, the first matching element in order 1..n is returned. For a Map input, an arbitrary matching element is returned. @param input The table t...
171
Roblox/dash
Roblox-dash-5a885be/src/findIndex.lua
luau
.lua
export type FindHandler<Value> = (Value, number) -> boolean --[=[ Returns the index of the first element in the _input_ array that satisfies the _handler_ predicate. @param input The array to search. @param handler Function called as `(value, index)` for each element; return `true` to select the index. @return Th...
149
Roblox/dash
Roblox-dash-5a885be/src/flat.lua
luau
.lua
local Dash = script.Parent local append = require(Dash.append) local forEach = require(Dash.forEach) -- TODO Luau: Support function generics --[=[ Flattens the input array by a single level. Outputs a new array of elements merged from the _input_ array arguments in left-to-right order. @param input The array of a...
138
Roblox/dash
Roblox-dash-5a885be/src/forEach.lua
luau
.lua
export type ForEachHandler<Key, Value> = (Value, Key) -> () --[=[ Iterates through the elements of the _input_ table and calls _handler_ for each entry. For an array input, the elements are visited in order 1..n. For a Map input, the keys are visited in an arbitrary order. @param input The table to iterate over....
134
Roblox/dash
Roblox-dash-5a885be/src/forEachArgs.lua
luau
.lua
export type ForEachArgsHandler<Value> = (Value, number) -> () --[=[ Iterates through the tail arguments in order, including nil values up to the argument list length. @param handler Function called as `(value, index)` for each argument. @param ... Variable arguments to iterate over. ]=] local function forEachArgs<...
111
Roblox/dash
Roblox-dash-5a885be/src/format.lua
luau
.lua
local Dash = script.Parent local formatValue = require(Dash.formatValue) local splitOn = require(Dash.splitOn) local startsWith = require(Dash.startsWith) local concat = table.concat local insert = table.insert --[=[ Returns the _format_ string with placeholders `{...}` substituted with readable representations of t...
939
Roblox/dash
Roblox-dash-5a885be/src/formatValue.lua
luau
.lua
local Dash = script.Parent --[=[ Formats a specific _value_ using the specified _displayString_. @param value The value to format. @param displayString Optional display string specifying the format. @return The formatted string representation of the value. @example ```luau formatValue(255, "06X") --> "0000FF"...
422
Roblox/dash
Roblox-dash-5a885be/src/freeze.lua
luau
.lua
local Dash = script.Parent local Error = require(Dash.Error) local format = require(Dash.format) local ReadonlyKey = Error.new("ReadonlyKey", "Attempted to write to readonly key {key:?} of frozen object {objectName:?}") local MissingKey = Error.new("MissingKey", "Attempted to read missing key {key:?} of frozen object...
686
Roblox/dash
Roblox-dash-5a885be/src/frequencies.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) local reduce = require(Dash.reduce) type FrequenciesHandler<Key, Value, NewKey> = (Value, Key) -> NewKey --[=[ Returns a map counting the frequency of unique values in the _input_ table. If no _handler_ is provided, counts occurrences of each unique valu...
398
Roblox/dash
Roblox-dash-5a885be/src/get.lua
luau
.lua
--[=[ Returns the value at _path_ from _object_. If resolution yields `nil`, _defaultValue_ is returned instead. @param object The table to query. @param path An array of keys to traverse on _object_. @param defaultValue The value to return when the resolved value is `nil`. @return The resolved value at _path_, o...
290
Roblox/dash
Roblox-dash-5a885be/src/getOrSet.lua
luau
.lua
export type GetValueHandler<Key, Value> = ({ [Key]: Value }, Key) -> Value --[=[ Returns the value at _key_ from the _input_ table. If the key is missing, calls _getValue_ to compute a value, stores it on _input_, and returns it. @param input The table to read from (and potentially write to). @param key The key ...
179
Roblox/dash
Roblox-dash-5a885be/src/identity.lua
luau
.lua
--[=[ Returns the input parameters unchanged. Can be used to make it clear that a handler returns its inputs unchanged. @param ... The input parameters to return. @return The input parameters unchanged. ]=] local function identity<T...>(...: T...): T... return ... end return identity
62
Roblox/dash
Roblox-dash-5a885be/src/includes.lua
luau
.lua
--[=[ Returns `true` if the _item_ exists as a value in the _input_ table. A nil _item_ will always return `false`. @param input The table to search in. @param item The value to search for. @return `true` if the item is found, `false` otherwise. ]=] local function includes(input: {}, item: any?): boolean if ite...
124
Roblox/dash
Roblox-dash-5a885be/src/init.lua
luau
.lua
local Types = require(script.Types) export type Map<Key, Value> = Types.Map<Key, Value> export type Set<Key> = Types.Set<Key> export type Table = Types.Table export type Class<Object> = Types.Class<Object> export type AnyFunction = Types.AnyFunction local Dash = { all = require(script.all), append = require(script....
607
Roblox/dash
Roblox-dash-5a885be/src/isCallable.lua
luau
.lua
--[=[ Returns `true` if the value can be called i.e. you can write `value(...)`. @param value The value to check if it's callable. @return `true` if the value is callable, `false` otherwise. ]=] local function isCallable<T>(value: T): boolean return type(value) == "function" or (type(value) == "table" and getmet...
107
Roblox/dash
Roblox-dash-5a885be/src/isLowercase.lua
luau
.lua
local Dash = script.Parent local assertEqual = require(Dash.assertEqual) --[=[ Returns `true` if the first character of _input_ is a lower-case character. Throws if the _input_ is not a string or it is the empty string. Our current version of Lua unfortunately does not support upper or lower-case detection outsid...
192
Roblox/dash
Roblox-dash-5a885be/src/isUppercase.lua
luau
.lua
local Dash = script.Parent local assertEqual = require(Dash.assertEqual) --[=[ Returns `true` if the first character of _input_ is an upper-case character. Throws if the _input_ is not a string or it is the empty string. Our current version of Lua unfortunately does not support upper or lower-case detection outsi...
196
Roblox/dash
Roblox-dash-5a885be/src/iterable.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) --[=[ Creates a stateful iterator for the _input_ table, first visiting ordered numeric keys 1..n and then the remaining unordered keys in any order. @param input The table to create an iterator for. @return A stateful iterator function that yields `(key...
311
Roblox/dash
Roblox-dash-5a885be/src/iterator.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) --[=[ Returns an iterator for _input_: `ipairs` when it's a non-empty array, otherwise `pairs` for tables; if _input_ is a function, it is returned as-is. This function can be used to build behavior that iterates over both arrays and Maps. @return A sta...
203
Roblox/dash
Roblox-dash-5a885be/src/join.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) local assign = require(Dash.assign) --[=[ Returns a new Map by merging all keys from the provided Map arguments in left-to-right order. The `None` symbol can be used to remove existing elements. @param ... Any number of tables to merge. @return A new M...
99
Roblox/dash
Roblox-dash-5a885be/src/joinArrays.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) --[=[ Returns a new array containing the joined elements of the arrays passed. @param ... Any number of arrays to join. @return A new array containing the joined elements. ]=] local function joinArrays(...: {}?): Types.Table local arrays = { ... } loca...
121
Roblox/dash
Roblox-dash-5a885be/src/joinDeep.lua
luau
.lua
local Dash = script.Parent local None = require(Dash.None) local Types = require(Dash.Types) local forEach = require(Dash.forEach) -- TODO Luau: Support typing varargs -- TODO Luau: Support function generics --[=[ Creates a shallow clone of the _source_ map, and copies the values from the _delta_ map by key, like the...
325
Roblox/dash
Roblox-dash-5a885be/src/keys.lua
luau
.lua
local insert = table.insert --[=[ Returns an array of the keys in the _input_ table. If the input is an array, ordering is preserved. If the input is a Map, elements are returned in an arbitrary order. @param input The table to extract keys from. @return An array containing all keys from the input table. ]=] lo...
105
Roblox/dash
Roblox-dash-5a885be/src/last.lua
luau
.lua
export type FindHandler<Value> = (Value, number) -> boolean --[=[ Returns the last element in the _input_ array that satisfies the _handler_ predicate. If no _handler_ is provided, returns the last element of the array. If no entries satisfy the condition, returns `nil`. @param input The array to search. @param...
195
Roblox/dash
Roblox-dash-5a885be/src/leftPad.lua
luau
.lua
--[=[ Makes a string of _length_ from _input_ by repeating characters from _prefix_ at the start of the string. @param input The string to pad. @param length The desired total length of the result. @param prefix The character(s) to use for padding; defaults to a single space. @return A new string padded to the sp...
246
Roblox/dash
Roblox-dash-5a885be/src/map.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) local assertEqual = require(Dash.assertEqual) export type MapHandler<Key, Value, NewValue> = (Value, Key) -> NewValue --[=[ Returns a new table by applying the _handler_ to each element of _input_. For an array input, the elements are visited in order 1....
240
Roblox/dash
Roblox-dash-5a885be/src/mapFirst.lua
luau
.lua
export type MapHandler<Value, NewValue> = (Value, number) -> NewValue? --[=[ Iterates through the elements of the _input_ array in order 1..n and returns the first non-nil value from the _handler_. If all values returned by the _handler_ are `nil`, `nil` is returned. @param input The array to iterate over. @para...
189
Roblox/dash
Roblox-dash-5a885be/src/mapLast.lua
luau
.lua
export type MapHandler<Value, NewValue> = (Value, number) -> NewValue? --[=[ Iterates through the elements of the _input_ array in reverse order n..1 and returns the first non-nil value from the _handler_. If all values returned by the _handler_ are `nil`, `nil` is returned. @param input The array to iterate over...
199
Roblox/dash
Roblox-dash-5a885be/src/mapNotNil.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) export type MapHandler<Key, Value, NewValue> = (Value, Key) -> NewValue --[=[ Returns a new table by applying the _handler_ to each element of _input_. For a Map input, the elements are visited in an arbitrary order. If a nil value is returned from the...
214
Roblox/dash
Roblox-dash-5a885be/src/mapOne.lua
luau
.lua
export type MapHandler<Key, Value, NewValue> = (Value, Key) -> NewValue? --[=[ Iterates through the elements of the _input_ table in no particular order and returns the first non-nil value. If a _handler_ is provided, returns the first non-nil value returned by the handler. If no _handler_ is provided, returns the...
220
Roblox/dash
Roblox-dash-5a885be/src/max.lua
luau
.lua
local Dash = script.Parent local reduce = require(Dash.reduce) -- Return true if a > b type MaxComparator = (any, any) -> boolean type MaxHandler = (any, any) -> any local defaultComparator = function(a: number | string, b: number | string) return a > b end --[=[ Returns the maximum value in the _input_ table. By ...
561
Roblox/dash
Roblox-dash-5a885be/src/memoize.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) export type ResolverFunction = (...any) -> string --[=[ Creates a function that memoizes the result of _func_. The memoized function will cache results based on the arguments provided. If a resolver function is provided, it will be used to generate the cac...
331
Roblox/dash
Roblox-dash-5a885be/src/min.lua
luau
.lua
local Dash = script.Parent local reduce = require(Dash.reduce) -- Return true if a < b type MinComparator = (any, any) -> boolean type MinHandler = (any, any) -> any local defaultComparator = function(a, b) return a < b end -- TODO (AleksandrSl 03/06/2024): Can be further "optimized" by writing a compare function t...
590
Roblox/dash
Roblox-dash-5a885be/src/noop.lua
luau
.lua
--[=[ A function which does nothing. Can be used to make it clear that a handler has no function. @return Always returns `nil`. ]=] -- selene: allow(unused_variable) local function noop(...: any) end return noop
53
Roblox/dash
Roblox-dash-5a885be/src/omit.lua
luau
.lua
local Dash = script.Parent local collectSet = require(Dash.collectSet) local forEach = require(Dash.forEach) local Types = require(Dash.Types) --[=[ Returns a new table made from entries in the _input_ table whose key is not in the _keys_ array. If the input is an array, ordering is preserved. If the input is a Ma...
181
Roblox/dash
Roblox-dash-5a885be/src/pick.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) export type PickHandler<Key, Value> = (Value, Key) -> boolean --[=[ Returns a new table containing only the entries from _input_ for which the _handler_ returns truthy. @param input The table to filter. @param handler Function called as `(value, key)` fo...
157
Roblox/dash
Roblox-dash-5a885be/src/pipe.lua
luau
.lua
--[=[ Creates a function that returns the result of passing a value through a pipeline of functions. Each function in the pipeline receives the result of the previous function. Functions are executed from left to right. @param f The first function in the pipeline. @param ... Additional functions to pipe. @return...
283
Roblox/dash
Roblox-dash-5a885be/src/pretty.lua
luau
.lua
local Dash = script.Parent local Types = require(Dash.Types) local append = require(Dash.append) local assign = require(Dash.assign) local cycles = require(Dash.cycles) local includes = require(Dash.includes) local join = require(Dash.join) local map = require(Dash.map) local keys = require(Dash.keys) local slice = re...
1,560
Roblox/dash
Roblox-dash-5a885be/src/product.lua
luau
.lua
local Dash = script.Parent local reduce = require(Dash.reduce) --[=[ Multiplies all numbers in the _input_ array. If the _input_ has no elements, returns `1`. @param input The array of numbers to multiply. @return The product of all numbers in the array. @example ```luau Dash.product({3, 3, 2}) --> 18 ``` ]...
129
Roblox/dash
Roblox-dash-5a885be/src/reduce.lua
luau
.lua
export type ReduceHandler<Key, Value, Accumulator> = (Accumulator, Value, Key) -> Accumulator --[=[ Iterates through the elements of the _input_ table and calls the _handler_ for each element, passing the return of the previous call as the first argument. The _initial_ value is passed into the first call, and the ...
191
Roblox/dash
Roblox-dash-5a885be/src/reverse.lua
luau
.lua
local insert = table.insert --[=[ Reverses the order of the elements in the _input_ array. @param input The array to reverse. @return A new array with elements in reverse order. ]=] local function reverse<T>(input: { T }): { T } local output: { T } = {} for i = #input, 1, -1 do insert(output, input[i]) end r...
96
Roblox/dash
Roblox-dash-5a885be/src/rightPad.lua
luau
.lua
--[=[ Makes a string of _length_ from _input_ by repeating characters from _suffix_ at the end of the string. By default, suffix is " ". @param input The string to pad. @param length The desired total length of the result. @param suffix The character(s) to use for padding; defaults to a single space. @return A ...
252
Roblox/dash
Roblox-dash-5a885be/src/shallowEqual.lua
luau
.lua
--[=[ Returns `true` if the _left_ and _right_ values are equal (by the equality operator) or the inputs are tables, and all their keys are equal. @param left The first value to compare. @param right The second value to compare. @return `true` if the values are shallowly equal, `false` otherwise. ]=] local functio...
208
Roblox/dash
Roblox-dash-5a885be/src/slice.lua
luau
.lua
local insert = table.insert --[=[ Returns a portion of the _input_ array starting with the element at the _left_ index and ending with the element at the _right_ index (i.e. an inclusive range). If _left_ is not defined, it defaults to 1. If _right_ is not defined, it defaults to the length of the array (i.e. the ...
304
Roblox/dash
Roblox-dash-5a885be/src/some.lua
luau
.lua
export type SomeHandler<Key, Value> = (Value, Key) -> boolean --[=[ Iterates through the elements of the _input_ table in no particular order. Calls the _handler_ for each entry and returns `true` if the handler returns truthy for any element which it is called with. @param input The table to iterate over. @para...
166
Roblox/dash
Roblox-dash-5a885be/src/splitOn.lua
luau
.lua
local insert = table.insert --[=[ Splits _input_ into parts based on a _pattern_ delimiter and returns a table of the parts, followed by a table of the matched delimiters. @param input The string to split. @param pattern The delimiter pattern to split on. @return A tuple containing the parts array and delimiters ...
238
Roblox/dash
Roblox-dash-5a885be/src/startsWith.lua
luau
.lua
--[=[ Checks whether _input_ starts with the string _prefix_. @param input The string to check. @param prefix The prefix to check for. @return `true` if _input_ starts with _prefix_; otherwise `false`. @example ```luau startsWith("Fun Roblox Games", "Fun") --> true ``` @example ```luau startsWith("Chess",...
135
Roblox/dash
Roblox-dash-5a885be/src/sum.lua
luau
.lua
local Dash = script.Parent local reduce = require(Dash.reduce) --[=[ Sums all numbers in the _input_ array. If the input array has no elements, returns `0`. @param input The array of numbers to sum. @return The sum of all numbers in the array. @example ```luau Dash.sum({3, 2, 1}) --> 6 ``` ]=] local functio...
127