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 |
|---|---|---|---|---|---|
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/create_app/src/projects/nvim.luau | luau | .luau | local pesde_future_patch = require("./bin/pesde_future_patch")
local pesde_sha256_patch = require("./bin/pesde_sha256_patch")
local license_md = require("./bin/license_md")
local init_src = require("./bin/init_src")
local env_file = require("./bin/env_file")
local luau_rc = require("./bin/luau_rc")
local pesde_toml = r... | 542 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/create_app/src/projects/vscode.luau | luau | .luau | local pesde_future_patch = require("./bin/pesde_future_patch")
local pesde_sha256_patch = require("./bin/pesde_sha256_patch")
local vscode_settings = require("./bin/vscode_settings")
local license_md = require("./bin/license_md")
local init_src = require("./bin/init_src")
local env_file = require("./bin/env_file")
loca... | 587 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/create_app/src/projects/zed.luau | luau | .luau | local pesde_future_patch = require("./bin/pesde_future_patch")
local pesde_sha256_patch = require("./bin/pesde_sha256_patch")
local zed_settings = require("./bin/zed_settings")
local license_md = require("./bin/license_md")
local init_src = require("./bin/init_src")
local env_file = require("./bin/env_file")
local luau... | 584 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/dave/.zune/updateBinaries.luau | luau | .luau | -- TODO?
| 3 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/dave/src/buffer.luau | luau | .luau | --[=[
@class Dave.Buffer
Internal FFI interoperability helpers for the Dave package.
]=]
local stdPolyfills = require("../luau_packages/std_polyfills")
local Sys = require("./sys")
local ffi = stdPolyfills.ffi
--[=[
@within Dave.Buffer
]=]
local function toCString(value: string): FFIPointer
local length = #valu... | 1,439 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/dave/src/commitResult.luau | luau | .luau | --[=[
@class Dave.CommitResult
@__index Prototype
Holds the outcome of applying an MLS commit message via `Session:processCommit`.
A commit can succeed (the group epoch advanced), be ignored (the commit was redundant
or out-of-order), or fail hard (the commit was malformed). Always inspect `isFailed`
and `isIgn... | 826 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/dave/src/decryptor.luau | luau | .luau | --[=[
@class Dave.Decryptor
@__index Prototype
Decrypts incoming media frames using the DAVE protocol.
A Decryptor is created per remote participant stream. When the MLS group transitions
to a new epoch, call `transitionToKeyRatchet` with the ratchet derived for that
participant; the decryptor will maintain bot... | 1,550 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/dave/src/encryptor.luau | luau | .luau | --[=[
@class Dave.Encryptor
@__index Prototype
Encrypts outgoing media frames using the DAVE protocol.
An Encryptor operates on a single send stream. Once a `KeyRatchet` is set via
`setKeyRatchet`, each call to `encrypt` advances the ratchet and produces an
authenticated ciphertext. Before a ratchet is availabl... | 2,231 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/dave/src/init.luau | luau | .luau | --[=[
@class Dave
Entry point for the DAVE (Discord Audio/Video Encryption) end-to-end encryption protocol.
DAVE provides authenticated encryption for Discord voice channels using MLS
(Messaging Layer Security). The typical lifecycle for a client joining a voice channel is:
1. Create a `Session` and call `init`... | 942 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/dave/src/welcomeResult.luau | luau | .luau | --[=[
@class Dave.WelcomeResult
@__index Prototype
Holds the outcome of processing an MLS welcome message via `Session:processWelcome`.
A welcome message is sent by an existing group member when they commit a proposal to
add this client. Processing it transitions the session into the group and exposes the
initi... | 672 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/debugify/src/commands/capture.luau | luau | .luau | local CliBuilder = require("../../luau_packages/cli_builder")
local StdPolyfills = require("../../luau_packages/std_polyfills")
local diagnostics = require("../utilities/diagnostics")
local redact = require("../utilities/redact")
local command = CliBuilder.command
local ESC = "\x1b"
local LOG_MAX = 200
local LINE_WID... | 1,227 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/debugify/src/commands/info.luau | luau | .luau | local CliBuilder = require("../../luau_packages/cli_builder")
local StdPolyfills = require("../../luau_packages/std_polyfills")
local diagnostics = require("../utilities/diagnostics")
local command = CliBuilder.command
local color = not StdPolyfills.process.getEnv()["NO_COLOR"]
local BOLD = if color then "\x1b[1m" e... | 461 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/debugify/src/utilities/diagnostics.luau | luau | .luau | local StdPolyfills = require("../../luau_packages/std_polyfills")
local diagnostics = {}
local function resolveVersion(): string
local detectedRuntime = StdPolyfills.runtime.getRuntime()
if detectedRuntime == "Lute" then
local ok, result = pcall(StdPolyfills.process.run, "lute", { "--version" })
if ok and resu... | 295 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/debugify/src/utilities/redact.luau | luau | .luau | local sensitiveSubstrings: { string } = {
"token",
"secret",
"password",
"authorization",
"bearer",
"credential",
"api_key",
"apikey",
}
local function isSensitiveKeyword(keyword: string): boolean
local lowercaseKeyword = string.lower(keyword)
for _, substring in sensitiveSubstrings do
if string.find(lowe... | 936 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/discord_luau/src/init.luau | luau | .luau | local bot = require("@self/bot")
--[=[
@class DiscordLuau
Top level documentation for the Discord-Luau library, welcome! 👋
This package will represent the entrypoint to your adventure using Discord-Luau, through this package you'll generate
a discord Bot object, this bot Object enables you to write discord bots... | 160 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/example/src/init.luau | luau | .luau | local discordLuau = require("@self/../luau_packages/discord")
local discordBuilders = require("@self/../luau_packages/builders")
local opus = require("@self/../luau_packages/opus")
local env = require("@self/../../../.env")
local MAX_BARS = 60
local MIN_DBFS = -40
local discordBot = discordLuau.bot.new({
token = en... | 332 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/opus/src/buffer.luau | luau | .luau | --[=[
@class Opus.Buffer
@private
Internal FFI interoperability helpers for the Opus 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
local OpusBuffer =... | 434 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/opus/src/init.luau | luau | .luau | local Sys = require("@self/sys")
local Encoder = require("@self/encoder")
local Decoder = require("@self/decoder")
local Stats = require("@self/stats")
export type Encoder = Encoder.Encoder
export type Decoder = Decoder.Decoder
export type FrameStats = Stats.FrameStats
--[=[
@class Opus
FFI bindings for libopus, p... | 280 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/rest/src/init.luau | luau | .luau | local applicationRoleConnectionMetadata = require("@self/applicationRoleConnectionMetadata")
local invite = require("@self/invite")
local gateway = require("@self/gateway")
local emoji = require("@self/emoji")
local stageInstance = require("@self/stageInstance")
local application = require("@self/application")
local re... | 741 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/secret/src/init.luau | luau | .luau | --[=[
@class Secret
@__index Prototype
Implementation of a basic secret object in Luau, primarily used to store bot tokens so that
they can't be accidentally leaked into the console through a `print`
```luau
local a
a = secret.new("SOMETHING_SECRET")
print(a) --> "Secret(SOMETHIN--------)"
a = secret.new(1... | 637 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/snowflake/src/init.luau | luau | .luau | --[=[
@class Snowflake
@__index Prototype
Wrapper around Discord snowflakes, allowing developers to query information about a snowflake
]=]
local stdPolyfills = require("./luau_packages/std_polyfills")
local DISCORD_EPOCH = 1420070400000
local Snowflake = {}
Snowflake.Interface = {}
Snowflake.Prototype = {}
lo... | 692 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/aead/aes256gcm.luau | luau | .luau | --[=[
@class Sodium.Aes256gcm
AES-256-GCM authenticated encryption, detached tag variant.
Requires AES-NI hardware support - call isAvailable() before use; libsodium will abort on CPUs without it.
Uses a 12-byte nonce; always use a strict counter and rotate the key before reaching 2^32.
]=]
local Sys = require("... | 1,269 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-c74054b/packages/sodium/src/aead/chacha20poly1305.luau | luau | .luau | --[=[
@class Sodium.Chacha20poly1305
ChaCha20-Poly1305 (IETF, 12-byte nonce) authenticated encryption, detached tag variant.
Does not require AES-NI and works on all CPUs; for random nonces at scale use `xchacha20poly1305` instead.
Always use a strict counter nonce and rotate the key before reaching 2^32 messages... | 1,276 |
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 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/batch-process.luau | luau | .luau | local main = require('./src/main')
main() | 10 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/examples/ds2-migrate-delete.luau | luau | .luau | --[[
This script will:
- Migrate the latest version of the DS2 data store to the migrated data store,
- Delete all of the entries in the DS2 data store except for the latest version.
This script migrates the latest version of the DS2 data store to the migrated data store,
and keeps the latest version in the ... | 836 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/examples/ds2-migrate.luau | luau | .luau | --[[
This script will:
- Migrate the latest version of the DS2 data store to the migrated data store,
- Delete all of the entries in the DS2 data store except for the latest version.
This script migrates the latest version of the DS2 data store to the migrated data store,
and keeps the latest version in the ... | 609 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/libs/frkcli/frkcli.luau | luau | .luau | --!nolint LocalShadow
local process = require("@lune/process")
local M = {}
type ArgKind = "POSITIONAL" | "FLAG" | "OPTION"
type ArgOptions = {
help: string?,
aliases: { string }?,
default: string?, -- if this is not nil, the arg will be optional
}
-- this is what is stored, we guarante non nullity when... | 4,269 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/libs/llc_tasks/init.luau | luau | .luau | return require("./tasks") | 5 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/libs/llc_tasks/tasks.luau | luau | .luau | --!nolint LocalShadow
local fs = require("@lune/fs")
local LuaEncode = require("./LuaEncode")
local tasks_client = require("./tasks_client")
local utils = require("./utils")
local m_tasks = {}
export type Error = tasks_client.TasksError
export type CreateTaskParams = tasks_client.CreateTaskParams
export type PollTas... | 1,008 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/libs/llc_tasks/utils.luau | luau | .luau | local m_utils = {}
function m_utils.notnil_or_default<T>(v: T?, d: T): T
if v == nil then
return d
end
return v
end
-- allows chaining member accesses forwarding nil if any intermediate step was nil
-- []/index to access members
-- () to get the value, optionally pass in a default
function m_utils... | 207 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/cli/core.luau | luau | .luau | --!strict
--[[
Core CLI functionality for parsing and handling command line arguments.
]]
-- Native Libraries
local process = require('@lune/process')
-- External Libraries
local frkcli = require('../../libs/frkcli/frkcli')
-- Local Libraries
local Constants = require('../shared/constants')
--[[
Generates ... | 974 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/commands/list.luau | luau | .luau | --!strict
--[[
Command for stopping a batch processing operation.
]]
-- Native Libraries
local process = require('@lune/process')
-- Local Libraries
local CLIO = require('../util/clio')
local ConfigValidators = require('../config/validators')
local Constants = require('../shared/constants')
local OpenCloudClient... | 744 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/config/validators.luau | luau | .luau | --!strict
--[[
Contains the validation handlers for each of the config values. Validation handlers
should validate the config value provided via these three means:
1. Command Line Arguments
2. Config File
3. Command Prompt
If the config value is valid, it should convert it to the correct ... | 6,154 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/main.luau | luau | .luau | --!strict
--[[
Main entry point for the batch processor CLI.
This module handles command line argument parsing, configuration loading,
and execution of batch processing commands.
]]
-- Native Libraries
local process = require('@lune/process')
-- Local Libraries
local CLI = require('./cli/core')
local CLI... | 569 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/shared/constants.luau | luau | .luau | --!strict
--[[
Constants used throughout the codebase.
]]
-- Local Libraries
local Types = require('./types')
-- Constants
local ActiveStage1TasksFile = "stage1_session_paths_active.output" -- The output file that contains the active stage 1 session paths
local ActiveStage2TasksFile = "stage2_session_paths_activ... | 2,630 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/util/fileio.luau | luau | .luau | --!strict
--[[
File I/O utility functions.
]]
-- Native Libraries
local fs = require('@lune/fs')
local serde = require('@lune/serde')
-- Local Libraries
local Constants = require('../shared/constants')
-- File IO
local FileIO = {}
--[[
Gets the directory from a filepath.
@param filepath string - The fu... | 1,418 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/util/formulas.luau | luau | .luau | --!strict
--[[
This file contains formulas for calculating the maximum and minimum memory stores storage and access that a batch process can use.
]]
-- Local Libraries
local Types = require('../shared/types')
-- Constants
local BUFFER_BYTES = 1024 -- Extra 1kb buffer
local BATCH_PROCESS_OVERHEAD_BYTES = 1125 -- ... | 1,338 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/util/guid-util.luau | luau | .luau | --!strict
--[[
Generates random GUIDs (UUID v4) using basic Lua functions.
]]
-- Constants for GUID generation
local HEX_CHARS = "0123456789abcdef"
local GUID_TEMPLATE = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
-- GuidUtil
local GuidUtil = {}
--[[
Generates a random hex character
@return string - A random... | 338 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/util/process-util.luau | luau | .luau | --!strict
--[[
Main utility functions for managing batch processes.
]]
-- Native Libraries
local fs = require('@lune/fs')
local serde = require('@lune/serde')
local task = require('@lune/task')
-- Local Libraries
local CLIO = require('../util/clio')
local Constants = require('../shared/constants')
local FileIO =... | 4,117 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/util/stage1-util.luau | luau | .luau | --!strict
--[[
This module handles the creation and management of stage 1 tasks for batch processing.
]]
-- Native Libraries
local process = require('@lune/process')
-- External Libraries
local llc_tasks = require('../../libs/llc_tasks/tasks')
-- Local Libraries
local CLIO = require('./clio')
local Constants = ... | 1,678 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/util/stage2-util.luau | luau | .luau | --!strict
--[[
This module handles the creation and management of stage 2 tasks for batch processing.
]]
-- Native Libraries
local process = require('@lune/process')
-- External Libraries
local llc_tasks = require('../../libs/llc_tasks/tasks')
-- Local Libraries
local CLIO = require('./clio')
local Constants = ... | 1,457 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/util/table-util.luau | luau | .luau | --!strict
--[[
Formats arguments into fixed-width blocks with separators.
]]
-- Local Libraries
local Constants = require('../shared/constants')
-- TableUtil
local TableUtil = {}
--[[
Formats a value to fit within a block of specified width.
If the value is too long, it will be truncated with "...".
... | 470 |
Roblox/data-stores-batch-processor-cli | Roblox-data-stores-batch-processor-cli-27c6164/src/util/time-util.luau | luau | .luau | --!strict
--[[
Time utility for handling Unix timestamps and datetime formatting.
]]
-- Native Libraries
local datetime = require("@lune/datetime")
-- TimeUtil
local TimeUtil = {}
--[[
Converts a Unix timestamp in milliseconds to a DateTime string.
@param timestamp number - Unix timestamp in millisecond... | 123 |
Kampfkarren/protoc-gen-luau | Kampfkarren-protoc-gen-luau-398d559/conformance/generated/google/protobuf/any.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint ImportUnused
--# selene: allow(empty_if, if_same_then_else, manual_table_clone, unused_variable)
-- This file was @autogenerated by protoc-gen-luau
local proto = require("../../proto")
local typeRegistry = require("../../proto/typeRegistry")
type _Messages = {
Any: _AnyMessag... | 1,761 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.