repo stringclasses 350
values | file_path stringlengths 29 200 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.01M | tokens int64 2 598k |
|---|---|---|---|---|---|
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/aead/xchacha20poly1305.luau | luau | .luau | --[=[
@class Sodium.Xchacha20poly1305
XChaCha20-Poly1305 (24-byte nonce) authenticated encryption, detached tag variant.
Extends ChaCha20-Poly1305 with a 192-bit nonce, making random nonce generation safe at any scale.
Requires no hardware acceleration and runs at constant time on all CPUs.
]=]
local Sys = requi... | 1,268 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/auth.luau | luau | .luau | --[=[
@class Sodium.Auth
HMAC-SHA512256 symmetric MAC - produces and verifies 32-byte authentication tags.
The verification step runs in constant time to prevent timing attacks.
Both parties must share the same secret key; use an AEAD module for encrypted messages.
]=]
local Sys = require("./sys")
local Buffer = ... | 612 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/box.luau | luau | .luau | --[=[
@class Sodium.Box
X25519 + XSalsa20-Poly1305 public-key authenticated encryption.
Encrypts from sender secret key to recipient public key; only the recipient can decrypt.
Both parties must know each other's public key; call `precompute` once per recipient
to derive a shared key and avoid repeated Diffie-Hel... | 3,479 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/buffer.luau | luau | .luau | --[=[
@class Sodium.Buffer
@private
Internal FFI interoperability helpers for the Sodium package.
Wraps `stdPolyfills.ffi` into named operations so higher-level modules never interact with it directly.
]=]
local stdPolyfills = require("../luau_packages/std_polyfills")
local ffi = stdPolyfills.ffi
--[=[
@type E... | 1,051 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/generichash.luau | luau | .luau | --[=[
@class Sodium.Generichash
BLAKE2b hashing with variable output length (16–64 bytes), optional key, and streaming support.
Can be used unkeyed (like SHA-256) or keyed (as a MAC).
One-shot (`hash`): hashes a buffer in a single call.
Streaming (`new` → `update` → `final`): hashes data incrementally; `final` ma... | 1,513 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/hash.luau | luau | .luau | --[=[
@class Sodium.Hash
SHA-256 and SHA-512 one-shot hash functions.
For a keyed hash or variable-length output, prefer `generichash`; for password hashing, use `pwhash`.
]=]
local Sys = require("./sys")
local Buffer = require("./buffer")
local Hash = {}
Hash.Interface = {}
--[=[
@within Sodium.Hash
Returns... | 362 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/init.luau | luau | .luau | --[=[
@class Sodium
FFI bindings for libsodium, providing authenticated encryption, hashing, signing, and key-derivation primitives.
All functions use pre-built libsodium binaries bundled with this package - no system installation is required.
]=]
--[=[
@prop sys Sodium.Sys
@within Sodium
]=]
--[=[
@prop aes2... | 668 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/pwhash.luau | luau | .luau | --[=[
@class Sodium.Pwhash
Argon2id password hashing and key derivation from passwords - all operations are intentionally slow.
Key derivation (`hash`): derives a fixed-length symmetric key from a password and a random salt.
Password storage (`hashStr`/`verifyStr`): produces a self-contained encoded string with em... | 1,340 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/randombytes.luau | luau | .luau | --[=[
@class Sodium.Randombytes
Cryptographically secure random byte generation backed by the OS CSPRNG.
Exposes libsodium's `randombytes_buf` for cases where raw random bytes are needed directly.
]=]
local Sys = require("./sys")
local Buffer = require("./buffer")
local Randombytes = {}
Randombytes.Interface = {... | 239 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/secretbox.luau | luau | .luau | --[=[
@class Sodium.Secretbox
XSalsa20-Poly1305 symmetric authenticated encryption with a shared secret key.
Both combined (`seal`/`open`) and detached (`sealDetached`/`openDetached`) forms are available.
Combined: 16-byte MAC prepended to ciphertext. Detached: MAC and ciphertext returned separately as `{ cipher, ... | 1,896 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/tests/helpers.luau | luau | .luau | local function makeBuffer(s: string): buffer
local b = buffer.create(#s)
buffer.writestring(b, 0, s)
return b
end
local function bufferEqual(a: buffer, b: buffer): boolean
if buffer.len(a) ~= buffer.len(b) then
return false
end
return buffer.readstring(a, 0, buffer.len(a)) == buffer.readstring(b, 0, buffer.len... | 108 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/datetime.luau | luau | .luau | --[=[
@class StdPolyfills.datetime
]=]
local runtime = require("./runtime")
local datetime = {}
--[=[
@within StdPolyfills.datetime
Creates a new DateTime from an ISO 8601 date-time string.
]=]
function datetime.fromIsoDate(isoDate: string): DateTime
local target = runtime.assertRuntime()
if target == "Lune" ... | 632 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/eryx/datetime.luau | luau | .luau | local date = require("@eryx/date")
local datetime = {}
local EPOCH = date.fromTimestamp(0)
-- Duration.totalSeconds and .totalMilliseconds are number properties, not methods
local function wrap(dt)
local diff = dt:diff(EPOCH)
local totalMilliseconds = diff.totalMilliseconds
return {
unixTimestamp = math.floor(... | 204 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/eryx/ffi.luau | luau | .luau | -- selene: allow(undefined_variable)
local erxFfi = require("@eryx/_ffi")
local erxOs = require("@eryx/os")
local ffi = {}
local TYPES = {
void = erxFfi.void,
i8 = erxFfi.i8,
u8 = erxFfi.u8,
i16 = erxFfi.i16,
u16 = erxFfi.u16,
i32 = erxFfi.i32,
u32 = erxFfi.u32,
i64 = erxFfi.i64,
u64 = erxFfi.u64,
pointer =... | 616 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/eryx/fileSystem.luau | luau | .luau | local fsWatch = require("@eryx/_fs_watch")
local fs = require("@eryx/fs")
local fileSystem = {}
local function readFileRaw(path: string): string
local file = fs.openSync(path, "r")
local data = file:read()
file:close()
return data
end
function fileSystem.readFile(path: string): string
return readFileRaw(path)
... | 530 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/eryx/process.luau | luau | .luau | local erxOs = require("@eryx/os")
local process = {}
-- os.arch() returns "x64"/"arm64"/"arm"/"x86" - map to the polyfill's expected output values
local archMap: { [string]: string } = {
x64 = "x86_64",
arm64 = "aarch64",
arm = "aarch64",
x86 = "x86_64",
}
process.os = (erxOs.platform() or "linux") :: "linux" | ... | 290 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/eryx/serde.luau | luau | .luau | local brotli = require("@eryx/compression/brotli")
local gzip = require("@eryx/compression/gzip")
local zlib = require("@eryx/compression/zlib")
local json = require("@eryx/data/json")
local toml = require("@eryx/data/toml")
local yaml = require("@eryx/data/yaml")
local serde = {}
local function toBuffer(data: string... | 492 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/eryx/task.luau | luau | .luau | return require("@eryx/task")
| 7 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/ffi.luau | luau | .luau | --[=[
@class StdPolyfills.ffi
FFI polyfill for loading and calling native shared libraries. Only available on Zune;
calling any function from an unsupported runtime will raise an error.
Use `dlopen` to load a shared library and bind its exported C functions. Use `struct` to
describe C struct layouts, `closure` t... | 3,568 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/fileSystem.luau | luau | .luau | --[=[
@class StdPolyfills.fileSystem
]=]
local runtime = require("./runtime")
local fileSystem = {}
--[=[
@within StdPolyfills.fileSystem
]=]
function fileSystem.readFile(path: string): string
local target = runtime.assertRuntime()
if target == "Lune" then
return require("./lune/fileSystem").readFile(path)
e... | 1,735 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/io.luau | luau | .luau | --[=[
@class StdPolyfills.io
]=]
local runtime = require("./runtime")
local io = {}
io.terminal = {
enableRawMode = function()
local target = runtime.assertRuntime()
if target == "Lune" then
return require("./lune/io").terminal.enableRawMode()
elseif target == "Zune" then
return require("./zune/io").t... | 897 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lune/datetime.luau | luau | .luau | return require("@lune/datetime")
| 8 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lune/fileSystem.luau | luau | .luau | -- selene: allow(undefined_variable)
local fs = require("@lune/fs")
local task = require("@lune/task")
local fileSystem = {}
function fileSystem.readFile(path: string): string
return fs.readFile(path)
end
function fileSystem.readDir(path: string): { string }
return fs.readDir(path)
end
function fileSystem.readDir... | 695 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lune/io.luau | luau | .luau | local io = {}
io.terminal = {
enableRawMode = function()
error("Lune does not support raw terminal mode")
end,
restoreMode = function()
error("Lune does not support raw terminal mode")
end,
getSize = function()
error("Lune does not support terminal size queries")
end,
}
function io.stdoutWrite(_data: stri... | 143 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lune/net.luau | luau | .luau | local net = setmetatable({}, { __index = require("@lune/net") })
net.socket = function(...)
local socket = require("@lune/net").socket(...)
local value = setmetatable({}, {
__index = socket,
})
function value.next(...: any)
return socket:next(...)
end
function value.close(...: any)
return socket:close(..... | 102 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lune/process.luau | luau | .luau | return require("@lune/process")
| 7 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lune/serde.luau | luau | .luau | return require("@lune/serde")
| 8 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lune/task.luau | luau | .luau | return require("@lune/task")
| 7 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lute/datetime.luau | luau | .luau | -- Lute has no calendar datetime API. Use os.time() (available via Luau's standard library).
local function isoFromTimestamp(timestamp: number): string
return os.date("!%Y-%m-%dT%H:%M:%SZ", timestamp) :: string
end
local function parseIsoDate(isoDate: string): number
local year, month, day, hour, minute, second = s... | 397 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lute/fileSystem.luau | luau | .luau | local stdFs = require("@std/fs")
local luteTask = require("@std/task")
local fileSystem = {}
function fileSystem.readFile(path: string): string
return stdFs.readFileToString(path)
end
function fileSystem.writeFile(path: string, contents: string)
stdFs.writeStringToFile(path, contents)
end
function fileSystem.read... | 860 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lute/process.luau | luau | .luau | local luteProcess = require("@std/process")
local luteSystem = require("@std/system")
local OS_MAP: { [string]: string } = {
linux = "linux",
macos = "macos",
windows = "windows",
}
local ARCH_MAP: { [string]: string } = {
x86_64 = "x86_64",
aarch64 = "aarch64",
arm64 = "aarch64",
}
local SIGNAL_MAP: { [string... | 384 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lute/serde.luau | luau | .luau | local json = require("@std/json")
local JSON_NULL = (json :: any).null
local function sanitizeNulls(value: any): any
if value == JSON_NULL then
return nil
elseif type(value) == "table" then
local internalKeys = {}
for key, fieldValue in pairs(value) do
if type(key) == "userdata" then
table.insert(inte... | 340 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/lute/task.luau | luau | .luau | return require("@std/task")
| 6 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/process.luau | luau | .luau | --[=[
@class StdPolyfills.process
]=]
local runtime = require("./runtime")
local process = {}
--[=[
@within StdPolyfills.process
Returns the current OS thats being used
]=]
function process.getPlatform(): OS
local target = runtime.assertRuntime()
if target == "Lune" then
return require("./lune/process").os ... | 1,243 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/roblox/datetime.luau | luau | .luau | -- selene: allow(undefined_variable)
local datetime = {}
-- Roblox's DateTime uses PascalCase; wrap to match the polyfill's camelCase shape
local function wrap(dt)
return {
unixTimestamp = dt.UnixTimestamp,
unixTimestampMillis = dt.UnixTimestampMillis,
toIsoDate = function(_self: any): string
return dt:ToIs... | 149 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/roblox/process.luau | luau | .luau | -- selene: allow(undefined_variable)
local process = {}
-- Roblox does not expose OS/env/args/cwd; return safe stubs so callers
-- that only read these for informational purposes don't crash
process.os = "windows" :: "windows" | "linux" | "macos"
process.args = {} :: { string }
process.env = {} :: { [string]: string... | 92 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/roblox/serde.luau | luau | .luau | -- selene: allow(undefined_variable)
local HttpService = game:GetService("HttpService")
local serde = {}
function serde.encode(format: string, value: any, _pretty: boolean?): string
if format == "json" then
return HttpService:JSONEncode(value)
end
error(`Unsupported serde format on Roblox: {format}`)
end
funct... | 229 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/roblox/task.luau | luau | .luau | -- selene: allow(undefined_variable)
return task
| 11 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/runtime.luau | luau | .luau | --[=[
@class StdPolyfills.runtime
]=]
local LUNE_STRING_MATCH = "(Lune) (%d+%.%d+%.%d+.*)+(%d+)"
local ZUNE_STRING_MATCH = "(zune) (%d+%.%d+%.%d+.*)+(%d+%.%d+)"
local ERYX_STRING_MATCH = "(eryx) (%d+%.%d+)"
local runtime = {}
--[=[
@within StdPolyfills.runtime
Will return the Runtime that this code is being exec... | 873 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/serde.luau | luau | .luau | --[=[
@class StdPolyfills.serde
]=]
local runtime = require("./runtime")
local serde = {}
--[=[
@within StdPolyfills.serde
Encodes the given value using the given format.
]=]
function serde.encode(format: EncodeDecodeFormat, value: any, pretty: boolean?): string
local target = runtime.assertRuntime()
if targe... | 813 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/task.luau | luau | .luau | --[=[
@class StdPolyfills.task
]=]
local runtime = require("./runtime")
local task = {}
--[=[
@within StdPolyfills.task
Stops a currently scheduled thread from resuming.
]=]
function task.cancel(thread: thread)
local target = runtime.assertRuntime()
if target == "Lune" then
return require("./lune/task").can... | 952 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/zune/datetime.luau | luau | .luau | -- selene: allow(undefined_variable)
local zuneTime = zune.time
local datetime = {}
local function wrapDateTime(dt)
return {
unixTimestamp = dt.timestamp,
unixTimestampMillis = dt.timestamp_millis,
toIsoDate = function(_self)
return dt:toIsoDate()
end,
}
end
function datetime.fromIsoDate(isoDate: string... | 144 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/zune/ffi.luau | luau | .luau | -- selene: allow(undefined_variable)
local impl = zune.ffi
return impl
| 19 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/zune/fileSystem.luau | luau | .luau | -- selene: allow(undefined_variable)
local fileSystem = {}
function fileSystem.readFile(path: string): string
return zune.fs.readFile(path)
end
function fileSystem.readDir(path: string): { string }
local entries = zune.fs.entries(path)
local names = {}
for _, entry in entries do
table.insert(names, entry.name)
... | 539 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/zune/io.luau | luau | .luau | -- selene: allow(undefined_variable)
local io = {}
io.terminal = {
enableRawMode = function()
return zune.io.terminal.enableRawMode()
end,
restoreMode = function()
return zune.io.terminal.restoreMode()
end,
getSize = function(): (number?, number?)
return zune.io.terminal.getSize()
end,
}
function io.stdou... | 140 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/zune/process.luau | luau | .luau | -- selene: allow(undefined_variable)
local process = {}
process.os = zune.platform.os
process.arch = zune.platform.cpu.arch
-- Zune includes the script path as args[1]; strip it to match Lune's convention
local rawArgs = zune.process.args
process.args = table.move(rawArgs, 2, #rawArgs, 1, {})
process.env = zune.proces... | 170 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/zune/serde.luau | luau | .luau | -- selene: allow(undefined_variable)
local zuneSerde = zune.serde
local serde = {}
function serde.encode(format: string, value: any, pretty: boolean?): string
if format == "json" then
local config = if pretty then { pretty_indent = zuneSerde.json.indents.four_spaces } else nil
return zuneSerde.json.encode(value,... | 503 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/std_polyfills/src/zune/task.luau | luau | .luau | -- selene: allow(undefined_variable)
return zune.task
| 13 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/utilities/src/coroutine/run.luau | luau | .luau | --[=[
@function Utilities.coroutineRun
@within Utilities
Creates a thread, resumes that thread - and handles errors if this resumed thread fails.
Will return the thread spawned.
@return thread
]=]
return function(callback: () -> (), ...)
local thread = coroutine.create(callback)
local success, errorMessage = ... | 92 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/utilities/src/createGuid.luau | luau | .luau | local template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
math.randomseed(os.clock() * 1e9)
--[=[
@function Utilities.createGuid
@within Utilities
Generates a random Guid (v4) that we can use to apply a unique identifier to objects.
@return string
]=]
return function()
local guid = string.gsub(template, "[xy]", ... | 131 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/utilities/src/init.luau | luau | .luau | --[=[
@class Utilities
Interface for the discord-luau Utilities package
]=]
return {
validateKebabCase = require("@self/validateKebabCase"),
validateCommandName = require("@self/validateCommandName"),
createGuid = require("@self/createGuid"),
coroutineRun = require("@self/coroutine/run"),
tableReflect = requir... | 84 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/utilities/src/table/reflect.luau | luau | .luau | --[=[
@function Utilities.tableReflect
@within Utilities
Will swap the K, V's, as well as keep the original K, Vs, for example:
```luau
local a = { a = 1, b = 2, c = 3 }
tableReflect(a)
--[[
a = {
-- default values
a = 1,
b = 2,
c = 3,
-- reflected values
[1] = "a",
[2] = "b",
[3] = "c"
}... | 179 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/utilities/src/validateCommandName.luau | luau | .luau | --[=[
@function Utilities.validateCommandName
@within Utilities
Validates a string as a Discord application command name.
Discord requires command names to be lowercase and only contain letters, numbers,
hyphens, underscores, or apostrophes (1–32 characters).
Will return either true/false, will not error.
@re... | 137 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/utilities/src/validateKebabCase.luau | luau | .luau | --[=[
@function Utilities.validateKebabCase
@within Utilities
Will validate a string to ensure that it's kebab-case, discord is sometimes very specific about the casing of
text.
Will return either true/false, will not error.
@return boolean
]=]
return function(source: string)
if source == "" then
return fal... | 173 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/voice/src/init.luau | luau | .luau | local connection = require("@self/connection")
local webSocket = require("@self/websocket")
local udp = require("@self/udp")
local rtp = require("@self/rtp")
local dave = require("@self/dave")
local jitter = require("@self/jitter")
export type Connection = connection.Connection
export type WebSocketTransport = webSock... | 279 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/websocket/src/init.luau | luau | .luau | local manager = require("@self/manager")
local shard = require("@self/shard")
export type Manager = manager.Manager
export type Shard = shard.Shard
--[=[
@class WebSocket
Interface for the discord-luau WebSocket package
]=]
--[=[
@prop manager WebSocket.Manager
@within WebSocket
]=]
--[=[
@prop shard WebSoc... | 97 |
dphfox/tiniest | dphfox-tiniest-ba9d9ef/src/tiniest.luau | luau | .luau | -- From dphfox/tiniest, licenced under BSD
--!strict
local tiniest_plugin = require("./tiniest_plugin")
type Context = DescribeContext | RunContext
type DescribeContext = {
type: "describe",
labels: {string},
add_test: (Test) -> ()
}
type RunContext = {
type: "run"
}
export type ErrorReport = {
type: "tiniest... | 1,404 |
dphfox/tiniest | dphfox-tiniest-ba9d9ef/src/tiniest_expect.luau | luau | .luau | -- From dphfox/tiniest, licenced under BSD
--!strict
local tiniest_quote = require("./tiniest_quote")
local tiniest_expect = {}
type Context = {
target: unknown,
test: string,
params: {unknown}
}
local context: Context = {
target = nil,
test = "",
params = {}
}
local function fail(
message: string?
): never... | 1,098 |
dphfox/tiniest | dphfox-tiniest-ba9d9ef/src/tiniest_for_roblox.luau | luau | .luau | -- From dphfox/tiniest, licenced under BSD
--!strict
local tiniest_expect = require("./tiniest_expect")
local tiniest_time = require("./tiniest_time")
local tiniest_pretty = require("./tiniest_pretty")
local tiniest = require("./tiniest")
export type Options = {
snapshot_path: string?,
save_snapshots: boolean?,
pr... | 665 |
dphfox/tiniest | dphfox-tiniest-ba9d9ef/src/tiniest_quote.luau | luau | .luau | -- From dphfox/tiniest, licenced under BSD
--!strict
local function tiniest_quote(
x: unknown,
given_indent_amount: number?
): string
if
type(x) == "nil" or
type(x) == "number" or
type(x) == "boolean" or
type(x) == "userdata"
then
return tostring(x)
elseif type(x) == "string" then
return string.fo... | 378 |
dphfox/tiniest | dphfox-tiniest-ba9d9ef/src/tiniest_snapshot.luau | luau | .luau | -- From dphfox/tiniest, licensed under BSD3
--!strict
local tiniest_quote = require("./tiniest_quote")
local tiniest = require("./tiniest")
type Test = tiniest.Test
export type TestRunResult = tiniest.TestRunResult & {
num_snapshots_updated: number,
num_snapshots_obsolete: number
}
export type RunResult = tiniest.R... | 1,293 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/init.luau | luau | .luau | --!strict
--!native
--[[
Penumbra: Init / Settings / Launch Parameters
This module handles inputs such as launch parameters provided via the Pajamas runtime,
a configurator for the Penumbra project, and provides settings & launch parameters to
every module calling afterwards.
How to launch:
local pajamas = ... | 1,407 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/deepfreeze.luau | luau | .luau | --!strict
--!native
--Deepfreeze: Freezes table and all child tables, prevents writes & improves read speeds when in tight loops
local function Deepfreeze<T>( t: T ): T
if type( t ) ~= "table" then
return t
end
local tab: {[any]: any} = t :: any
for _, v in tab do
-- Prevents cyclic tables from looping infinite... | 138 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/init.luau | luau | .luau | --[[
Penumbra: Shader module builder [Roblox]
This module allows you to build shader modules in Roblox Studio.
This works by inlining 'template/prepend.luau' and 'template/append.luau',
with your own provided shader modulein the middle.
If a shader module isn't provided, then 'template/shader.luau' module will... | 589 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/eotf/lrgb_true.luau | luau | .luau | --!strict
--!native
-- lRGB - Piecewise function
-- Separate shader function for legacy purposes.
-- Pixel shader: sRGB -> lRGB color space transform
-- Input is assumed to already be bound 0-1 sRGB
local sRGB_Sub: vector = vector.one * 0.055
local vector_zero = vector.zero
local vector_one = vector.one
ret... | 264 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/eotf/srgb_fast.luau | luau | .luau | --!strict
--!native
-- sRGB - Fast Approximation
local v_1: vector = vector.one * 1
local v_0_625: vector = vector.one * 0.625
local Reciprocal: vector = vector.one / 4.8
return function( iTime: number, In: {vector}, Out: {vector} )
for c = 1, #In do
Out[c] =
( v_1 - In[c] ) * ( In[c] / ( In[c] + Reciprocal )... | 153 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/eotf/srgb_fastest.luau | luau | .luau | --!strict
--!native
-- sRGB - Fastest Approximation - Highly inaccurate, performance tradeoff not really worth it
local v_1: vector = vector.one
local v_0_225: vector = vector.one * 0.225
return function( iTime: number, In: {vector}, Out: {vector} )
for c = 1, #In do
Out[c] = ( In[c] * ( In[c] * .225 + v_1 ) ) / ( ... | 125 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/eotf/srgb_pow.luau | luau | .luau | --!strict
--!native
-- sRGB Pow approximation
local vector_zero: vector = vector.zero
local vector_one: vector = vector.one
return function( iTime: number, In: {vector}, Out: {vector} )
for c: number, RGB: vector in In do
Out[c] = vector.create(RGB.x^.4545,RGB.y^.4545,RGB.z^.4545)
end
end
| 94 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/eotf/srgb_tanh.luau | luau | .luau | --!strict
--!native
-- sRGB Tanh approximation
local vector_zero: vector = vector.zero
return function( iTime: number, In: {vector}, Out: {vector} )
for c: number, RGB: vector in In do
Out[c] = vector.create(math.tanh(RGB.x),math.tanh(RGB.y),math.tanh(RGB.z))
end
end
| 88 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/eotf/srgb_true.luau | luau | .luau | --!strict
--!native
-- sRGB - Piecewise function
-- Separate shader function for legacy purposes.
-- Pixel shader: Linear -> sRGB color space transform
-- Input is assumed to already be bound 0-1 linear RGB
-- Bypass (number) -> (vector) broadcast performance hit
local sRGB_Sub: vector = vector.one * 0.055
local vec... | 308 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/tone/acesfilm.luau | luau | .luau | --!strict
--!native
-- Tonemapper: AcesFilm [Source: https://www.shadertoy.com/view/W3lfRN]
local v_1: vector = vector.one * 1
local v_0: vector = vector.zero
local v_0_625: vector = vector.one * 0.625
local v_0_003: vector = vector.one * 0.003
local v_0_59: vector = vector.one * 0.59
local v_0_14: vector = vec... | 255 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/tone/agx.luau | luau | .luau | --!strict
--!native
-- Tonemapper: AgX [Source: https://www.shadertoy.com/view/dtyfRw]
local Settings = require( "../../../Settings" )
local MinEV: number = -10 -- Tonemapper min. exposure
local MaxEV: number = 7.5 -- Tonemapper max. exposure
local To_AgX = {
vector.create(.842479062253094,.0423282422610123,.0423756... | 887 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/tone/crt.luau | luau | .luau | --!strict
--!native
-- Penumbra: Fragment Shader - CRT [Source: Crazyblox]
type f64=number; type vec=vector
local S, Textures = require( "../../../Settings" ), require( "../../../Textures" )
local vec = vector.create;local vec_1, vec_0_5, vec_0 = vec(1,1,1), vec(.5,.5,.5), vec(0,0);local iResolution:vec =vec(S.Display_... | 1,526 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/tone/linear.luau | luau | .luau | --!strict
--!native
local vector_zero: vector = vector.zero
local vector_one: vector = vector.one
return function( iTime: number, In: {vector}, Out: {vector} )
for c = 1, #In do
Out[c] = vector.clamp( In[c], vector_zero, vector_one )
end
end
| 78 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/old_incompatible/tone/reinhard.luau | luau | .luau | --!strict
--!native
-- Tonemapper: Reinhard RGB
local Burn: vector = vector.one
return function( iTime: number, In: {vector}, Out: {vector} )
for c: number = 1, #In do
Out[c] = In[c] / ( Burn + In[c] )
end
end
| 77 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/template/filter/append.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
local iRes0:vec = iRes-vec(1,1)
local iRes0_div:vec=iRes0+vec(0,0,1)
local tStart0:vec = vec(0,S.Actor_Res.y*(S.Actor_RenderNum-1))
local tRes1:vec = S.Actor_Res
local tRes0:vec = S.Actor_Res-vec(1,1)
local tEnd0:vec = tStart0+tRes0
local IL_Start:f64 = tStart0.y % 2
-- Interlace data & ... | 969 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/template/filter/prepend.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
type f64 = number; type vec = vector
local S = require( `../../../../` )()
local Textures = require( `../../../textures` )
local vec = vector.create
local vec_1, vec_0_5, vec_0 = vec( 1, 1, 1 ), vec( .5, .5, .5 ), vec( 0, 0 )
local iRes:vec = vec( S.Display_Res.x, S.Display_Res.y )
local ... | 2,520 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/template/filter/shader.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
local iChannel0: Textures.Texture = Textures.Load.Base( {}, "rustymetal" )
local texture = Sampler_Nearest -- Sampler_Nearest_IL, Sampler_Linear, Sampler_BoxBlur, Sampler_Unsharp
local function main( fragColor:vec, fragCoord:vec, iTime:f64 ):vec
-- Gradient - Sourced from [https://www.s... | 242 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/template/frag/append.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
local iRes0:vec = iRes-vec(1,1)
local iRes0_div:vec =iRes0+vec(0,0,1)
local tStart0:vec = vec(0,S.Actor_Res.y*(S.Actor_RenderNum-1))
local tRes1:vec = S.Actor_Res
local tRes0:vec = S.Actor_Res-vec(1,1)
local tEnd0:vec = tStart0+tRes0
local IL_Start:f64 = tStart0.y % 2
-- Interlace data &... | 953 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/builder/template/frag/prepend.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
type f64 = number; type vec = vector
local S = require( `../../../../` )()
local Textures = require( `../../../textures` )
local vec = vector.create
local vec_1, vec_0_5, vec_0 = vec( 1, 1, 1 ), vec( .5, .5, .5 ), vec( 0, 0 )
local iRes:vec = vec( S.Display_Res.x, S.Display_Res.y )
local ... | 1,438 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/init.luau | luau | .luau | --!strict
--!native
--[[ Requires ]]
local Settings = require(`../`)()
local Deepfreeze = require( `./deepfreeze` )
local VM = require( `../../plugin/process` )
local Task = require( `../../plugin/task` )
local Textures = require( `./textures` )
-- Types/Export
local Types = require( "@self/types" )
export type ... | 1,325 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/profile.luau | luau | .luau | --!strict
--!native
return { "frag/cave", "filter/blur_box", "filter/unsharp_gaussian" }
| 29 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/filter/blur_box.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
DoInterlace = false
local function Sampler_BoxBlur(t: Textures.Texture, UV: vector): vector
local tW:number, tH:number = t.Width, t.Height
UV = (UV * vector.create(tW,tH) + vector.create(.5,.5) ) // 1
local x0:number = UV.x % tW * u32B -- Wrap U to texture width
local y0:number = ... | 362 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/filter/unsharp_gaussian.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Gaussian Unsharp Mask 3x3 Kernel
local function Sampler_Unsharp(t: Textures.Texture, UV: vector): vector
local b = t.Buffer
local tW:number, tH:number = t.Width, t.Height
UV = (UV * vector.create(tW,tH) + vector.create(.5,.5) ) // 1
-- X1Y1
local x:number = UV.x % tW * u32B -- ... | 885 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/blackhole.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
local iChannel0: Textures.Texture = Textures.Load.Base( {}, "rustymetal" )
local texture = Sampler_Nearest -- Sampler_Nearest_IL, Sampler_Linear, Sampler_BoxBlur, Sampler_Unsharp
local PI: f64 = math.pi
local ro: vec = vec(0.0, 2.0, 14.0)
local lookAt: vec = vec(0.0, 0.0, 0.0)
local fwd:... | 2,618 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/cardgame.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Card Game [Source: https://www.shadertoy.com/view/XXtBRr]
local texture = Sampler_Nearest -- Sampler_Nearest_IL, Sampler_Linear
local SPIN_ROTATION:f64 = -2.0;
local SPIN_SPEED:f64 = 7.0;
local SPIN_EASE:f64 = 1.0;
local SPIN_AMOUNT:f64 = 0.25;
local OFFSET:... | 934 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/cloudytunnel.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Fragment Shader - Cloudy Tunnel [Source: https://www.shadertoy.com/view/llSfRK]
--// origo and lookat points
local o:vec
local t:vec
local oSquareTotal:f64
local sampleCount:f64 = 2
local W:f64 = 4.0
local T:f64 = 0.05
local texture = Sampler_Nearest_IL
-- Values
local iChannel0: Tex... | 1,202 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/creation.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Creation [Source: https://www.shadertoy.com/view/XsXXDn]
local iChannel0: Textures.Texture = Textures.Load.Base( {}, "abstract3" )
local texture = Sampler_Linear
local reinhardBurn:vec = vector.one * .225
local c = {0,0,0}
local function main( fragColor:vec,... | 358 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/distortion.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Distortion
local texture = Sampler_Linear
local blob1:vec = vec(127.1,311.7,0)
local blob2:vec = vec(269.5,183.3,0)
local blob3:vec = vec(419.2,317.9,0)
local function main( fragColor:vec, fragCoord:vec, iTime:f64 ):vec
local vec_noPreCalc:vec = vec(.5,.5)*... | 601 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/fractalpyramid.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Fractal Pyramid [Source: https://www.shadertoy.com/view/tsXBzS]
--[[ SHADER ]]--
local reinhardBurn:vec = vector.one * .225
local up_vector:vec = vec(0, 1, 0)
local const_ro:vec = vec(0, 0, -50)
local ro_xz:vec = vec(const_ro.x, const_ro.z)
local iTime_cos:f... | 859 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/fragments.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Fragments [Source: https://www.shadertoy.com/view/3cScWy]
local fEnd:f64 = 6
local iTime_z: vec
local r_xxy:vec = vec(iRes.x, iRes.y, iRes.y);
local mul_vec2:vec = vec(1, 1, 0);
local nums:vec = vec(6,1,2);
local function main( O:vec, I:vec, t:f64 ):vec
--... | 531 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/gyroid.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - tm gyroid 2 [Source: https://www.shadertoy.com/view/tXtyW8]
local reinhardBurn:vec = vector.one * .225
local FAR = 30.
local PI = 3.1415
local function vcos(v: vec) return vector.create(math.cos(v.x), math.cos(v.y), math.cos(v.z)) end
local function vsin(v:... | 1,717 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/hillside.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Mini: Hillside [Source: https://www.shadertoy.com/view/3fySDD]
local function main( fragColor:vec, fragCoord:vec, iTime:f64 ):vec
local p:vec = (fragCoord*2.-iRes)/iRes.y
--//Quick noise pattern
local n:f64 = (dot(fragCoord, vec(sin(fragCoord.y),sin(fragC... | 355 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/introduction.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Shader Art Coding Introduction [Source: https://www.shadertoy.com/view/mtyGWy]
local e:f64 = 2.71828183
local a:vec,b:vec,c:vec,d:vec = vec(.5,.5,.5),vec(.5,.5,.5),vec(1,1,1),vec(.263,.416,.557)
local function palette( t:f64 ):vec
local tau_ctd:vec = 6.2831... | 379 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/mandelbrot_pattern.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Mandelbrot Pattern Decoration [Source: https://www.shadertoy.com/view/ttscWn]
-- VARIABLES
local AA:f64 = 2
local AA0:f64 = AA - 1
local AA2_Reciprocal:f64 = 1 / (AA*AA)
local iter:f64 = 128
local fog:vec = vec_0
-- preprocessables
local ttm:f64, c:f64, s:f6... | 1,658 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/mandelbrot_standard.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Mandelbrot
local texture = Sampler_Linear
local function main( fragColor:vec, fragCoord:vec, iTime:f64 ):vec
local uv:vec = (vec(fragCoord.x/iRes.x,fragCoord.y/iRes.y)-vec(.5,.5))*2.
uv *= vec(iRes.x/iRes.y,1.)
local c:vec = uv * 0.8 + vec(-.5,0.) + vec( ... | 260 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/mosaic.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Mini: Mosaic [Source: https://www.shadertoy.com/view/W33GRX]
local texture = Sampler_Linear
local function main( fragColor:vec, fragCoord:vec, iTime:f64 ):vec
--//Resolution for scaling
local r:vec = iRes
--//Centered and scaled to fit vertically [-3, +3]... | 327 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/neuron.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Neuron
local vec_up = vec(0, 1, 0)
local ro, lookAt, fwd, right, up = vec(0,0,0), vec(0,0,0), vec(0,0,1), vec(1,0,0), vec(0,1,0)
local a = 2.51
local b_coeff = vec(0.0762, 0.0762, 0.0762)
local c_val = 2.43
local d_coeff = vec(0.59, 0.59, 0.59)
local e_coeff... | 2,829 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/nova.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Mini: Nova [Source: https://www.shadertoy.com/view/WfGSRD]
local function main( fragColor:vec, fragCoord:vec, iTime:f64 ):vec
--//Horizontally centered and scaled coordinates
local p:vec = (fragCoord*2.-(iRes.x*vec(1,1)))/iRes.y
--//Distance to circle edg... | 248 |
Crazyblox/penumbra | Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/rocaille.luau | luau | .luau | --!nocheck
--!nolint
--/INLINE
-- Penumbra: Fragment Shader - Rocaille [Source: https://www.shadertoy.com/view/WXyczK]
local resLen:f64
local function main( O:vec, I:vec, iTime:f64 ):vec
--// Vector for scaling and turbulence
local v:vec = iRes;
--// Centered and scaled coordinates
local p:vec = (I+I-v)/v.y/.3;
-... | 423 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.