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
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/Future.luau
luau
.luau
local Poll = require("./Poll") export type Poll<E, U...> = Poll.Poll<E, U...> local Result = require("./Result") export type Result<E, U...> = Result.Result<E, U...> --- @class Future --- --- A Future represents a read-only asynchronous value, one that may not --- have finished computation. --- --- Futures are lazy i...
2,290
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/Poll.luau
luau
.luau
local Result = require("./Result") type Result<E, U...> = Result.Result<E, U...> type PollImpl<E, U...> = { isReady: (self: Poll<E, U...>) -> boolean, isPending: (self: Poll<E, U...>) -> boolean, unwrap: (self: Poll<E, U...>) -> Result<E, U...>, } --- @class Poll --- --- A Poll represents the status of a [Result],...
892
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/Result.luau
luau
.luau
local utils = require("./utils") local prettyPrint = utils.prettyPrint type ResultType = "Ok" | "Err" type ResultImpl<E, U...> = { isOk: (self: Result<E, U...>) -> boolean, isErr: (self: Result<E, U...>) -> boolean, unwrapOk: (self: Result<E, U...>) -> U..., unwrapErr: (self: Result<E, U...>) -> E, } --- @class ...
668
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/after.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local describe = JestGlobals.describe local test = JestGlobals.test local expect = JestGlobals.expect local jest = JestGlobals.jest local Futures = require("../init") local Future = Futures.Future describe("after", function() test("success", function() local...
261
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/andThen.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future test("andThen", function() local myFuture = Future.new(function() return "a", "b", "c" end) local nextFuture = myFuture:andThe...
142
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/await.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local describe = JestGlobals.describe local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future describe("await", function() test("immediate", function() local myFuture = Future.new(funct...
211
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/chaining.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future test("chaining", function() expect.assertions(6) local myFuture = Future.new(function() return 1, 2, 3 end) :andThen(functio...
345
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/inspectError.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future test("inspectErr", function() local myFuture = Future.new(function() error("A", 0) end) myFuture:inspectErr(function(...) ex...
116
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/inspectOk.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future test("inspectOk", function() expect.assertions(3) local myFuture = Future.new(function() return "a", "b", "c" end) myFuture:...
142
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/join.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local describe = JestGlobals.describe local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future describe("join", function() test("ok", function() local myFuture = Future.new(function() ...
271
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/joinAll.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future test("joinAll", function() local myFuture = Future.new(function() return "a", "b", "c" end) local nextFuture = myFuture:joinAl...
221
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/mapError.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local describe = JestGlobals.describe local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future describe("mapErr", function() test("to error", function() local myFuture = Future.new(funct...
257
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/mapOk.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future test("mapOk", function() local myFuture = Future.new(function() return "a", "b", "c" end) myFuture:mapOk(function(a, b, c) r...
152
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/orElse.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future test("orElse", function() local myFuture = Future.new(function() error("A", 0) end) myFuture = myFuture:orElse(function(err) ...
151
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/ordering.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local describe = JestGlobals.describe local Futures = require("../init") local Future = Futures.Future describe("ordering", function() test("chaining", function() expect.assertions(7) local c...
465
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/poll.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local describe = JestGlobals.describe local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future describe("poll", function() test("immediate", function() local myFuture = Future.new(functi...
286
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/__tests__/unwrapOrElse.test.luau
luau
.luau
local JestGlobals = require("@DevPackages/JestGlobals") local test = JestGlobals.test local expect = JestGlobals.expect local Futures = require("../init") local Future = Futures.Future test("unwrapOrElse", function() local myFuture = Future.new(function() error("A", 0) end) myFuture = myFuture:unwrapOrElse(fun...
144
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/init.luau
luau
.luau
local Poll = require("@self/Poll") export type Poll<E, U...> = Poll.Poll<E, U...> local Result = require("@self/Result") export type Result<E, U...> = Result.Result<E, U...> local Future = require("@self/Future") :: any -- FUTURE: FutureLike<E, U...> = Future<E, U...> for backwards compatibility -- This type should ...
2,168
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/jest.config.luau
luau
.luau
return { testMatch = { "**/__tests__/*.(spec|test)", }, testPathIgnorePatterns = { "Packages", "DevPackages", }, }
41
YetAnotherClown/luau-futures
YetAnotherClown-luau-futures-e6e8cf8/src/utils.luau
luau
.luau
-- https://stackoverflow.com/questions/7526223/how-do-i-know-if-a-table-is-an-array/52697380#52697380 local function isArray(t) if type(t) ~= "table" then return false end if #t > 0 then return true end for _, _ in pairs(t) do return false end return true end local function printArray(arr, indentation:...
673
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/server/init.server.luau
luau
.luau
-- Benchmark server. Receives data from all modes and validates correctness. local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local BenchmarkConfig = require(ReplicatedStorage.Shared.BenchmarkConfig) local Payload...
1,757
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/BenchmarkConfig.luau
luau
.luau
-- Satset benchmark control. This is not a public Satset mode. local activeMode = "default" -- Two-client correctness check for Satset Groups. This skips the benchmark matrix local groupSmokeTest = false -- Use "static" for best-case compression, "moving" for game-like state local payloadVariant = "static" local events...
323
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/GroupSmoke.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Satset = require(ReplicatedStorage.references.Satset) return Satset.definePacket({ name = "GroupSmoke", schema = { stage = Satset.Types.u8, }, })
55
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/PayloadVariants.luau
luau
.luau
-- Payload variants: static (identical) and moving (per-frame + per-slot). local PayloadVariants = {} export type Variant = "static" | "moving" local VALID_VARIANTS = { static = true, moving = true, } local function byteOne(value: number): number return (value % 255) + 1 end local function makeVector(base: Vect...
920
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/benches/Booleans.luau
luau
.luau
-- 1000 boolean values. Tests minimal-payload throughput and packing efficiency. local Array = {} for _ = 1, 1000 do table.insert(Array, math.random() > 0.5) end return Array
49
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/benches/Entities.luau
luau
.luau
-- 100 entities, each with 6 u8 fields. Simulates a typical NPC/player sync payload. local Array = {} for _ = 1, 100 do table.insert(Array, { id = math.random(1, 255), x = math.random(1, 255), y = math.random(1, 255), z = math.random(1, 255), orientation = math.random(1, 255), animation = math.random(1, 25...
115
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/benches/Mixed.luau
luau
.luau
-- Realistic game packet: player state update with mixed types. -- Simulates what a typical game sends per player per frame. return { id = math.random(1, 255), health = math.random(0, 100), position = Vector3.new(math.random() * 2048 - 1024, math.random() * 512, math.random() * 2048 - 1024), velocity = Vector3.new(...
172
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/benches/SingleValue.luau
luau
.luau
-- Single u8 value. Tests per-call overhead with minimal payload. return math.random(1, 255)
23
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/benches/Strings.luau
luau
.luau
-- 100 short strings (8-32 chars). Tests variable-length serialization. local CHARS = "abcdefghijklmnopqrstuvwxyz0123456789" local Array = {} for _ = 1, 100 do local len = math.random(8, 32) local chars = table.create(len) for j = 1, len do local idx = math.random(1, #CHARS) chars[j] = string.sub(CHARS, idx, idx...
112
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/benches/Vectors.luau
luau
.luau
-- 100 Vector3 positions. Tests float serialization throughput. local Array = {} for _ = 1, 100 do table.insert(Array, Vector3.new(math.random() * 2048 - 1024, math.random() * 512, math.random() * 2048 - 1024)) end return Array
69
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/benches/init.luau
luau
.luau
-- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details -- Benchmark bench loader. Resets random seed for deterministic data across server/client. local Benches = {} for _, Bench in script:GetChildren() do math.randomseed(0) Benches[Bench.Name] = require(B...
79
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/blink.luau
luau
.luau
local RunService = game:GetService("RunService") local Benches = require(game:GetService("ReplicatedStorage").Shared.benches) local IsServer = RunService:IsServer() local Events = {} local BlinkAPI if IsServer then BlinkAPI = require(script.Parent.blink_gen.server) else BlinkAPI = require(script.Parent.blink_gen.c...
202
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/bridgenet2.luau
luau
.luau
-- BridgeNet2 benchmark mode (v1.0.0 API). -- BridgeNet2 uses ReferenceBridge with string identifiers. local BridgeNet2 = require(game:GetService("ReplicatedStorage").DevPackages.BridgeNet2) local Benches = require(game:GetService("ReplicatedStorage").Shared.benches) local Events = {} for Name in Benches do Events[...
100
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/init.luau
luau
.luau
-- Mode loader. Each mode wraps a networking library with a common interface. -- Disabled modes are skipped (set to true to disable). local BenchmarkConfig = require(script.Parent.BenchmarkConfig) local DISABLED_MODES = {} local function isSelected(name: string): boolean local selectedTools = BenchmarkConfig.selecte...
150
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/netray_compile.luau
luau
.luau
local RunService = game:GetService("RunService") local Benches = require(game:GetService("ReplicatedStorage").Shared.benches) local IsServer = RunService:IsServer() local Events = {} local NetRayAPI if IsServer then NetRayAPI = require(script.Parent.netray_compile_gen.Server) else NetRayAPI = require(script.Parent...
212
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/netray_compile_gen/Client.luau
luau
.luau
--!strict --!native --!optimize 2 --!nolint LocalShadow --#selene: allow(shadowing) -- Name: Client -- Purpose: Generated runtime for client networking -- Generated-by: NetRay-Compiler -- Version: 0.1.1 local Types = require(script.Parent.Types) type u8 = typeof(Types.u8) type i8 = typeof(Types.i8) type u16 = typeof(T...
11,583
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/netray_compile_gen/Server.luau
luau
.luau
--!strict --!native --!optimize 2 --!nolint LocalShadow --#selene: allow(shadowing) -- Name: Server -- Purpose: Generated runtime for server networking -- Generated-by: NetRay-Compiler -- Version: 0.1.1 local Types = require(script.Parent.Types) type u8 = typeof(Types.u8) type i8 = typeof(Types.i8) type u16 = typeof(T...
8,929
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/netray_compile_gen/Types.luau
luau
.luau
--!strict --!native --!optimize 2 -- Name: Types -- Purpose: Generated Luau types for NetRay schema -- Generated-by: NetRay-Compiler export type TypeBranding = "Off" | "On" export type ActiveTypeBranding = "Off" export type Brand<T, B> = T & { __brand: B } export type u8 = number export type i8 = number export type u1...
2,537
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/packet.luau
luau
.luau
-- Suphi Packet benchmark mode. -- Wraps each Packet object so `fire` is a self-bound closure, -- matching the benchmark harness convention (event.fire or event.Fire). local Packet = require(game:GetService("ReplicatedStorage").references.SuphiPacket) local function wrap(pkt) return { fire = function(data) pkt:F...
313
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/quicknet.luau
luau
.luau
-- QuickNet benchmark mode. local BenchmarkConfig = require(script.Parent.Parent.BenchmarkConfig) local QuickNet = require(game:GetService("ReplicatedStorage").references.QuickNet) local Data = QuickNet.Data local BENCHMARK_RATE_LIMIT = 1_000_000 local debugStats = { clientEvents = 0, clientEventBytes = 0, } local ...
779
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/quicknet/EnumsToNativeTypes.luau
luau
.luau
local Enums = require(script.Parent.Enums) return { [Enums.NumberU4] = "number", [Enums.NumberU8] = "number", [Enums.NumberU16] = "number", [Enums.NumberU32] = "number", [Enums.NumberI8] = "number", [Enums.NumberI16] = "number", [Enums.NumberI32] = "number", [Enums.NumberF16] = "number", [Enums.NumberF32] = "...
568
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/roblox.luau
luau
.luau
-- Native Roblox baseline. One RemoteEvent per bench, no serialization. local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local Benches = require(ReplicatedStorage.Shared.benches) local Events = {} local IsServer = RunService:IsServer() for Name in Benche...
150
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/satset.luau
luau
.luau
-- Satset benchmark mode. local RunService = game:GetService("RunService") local Satset = require(game:GetService("ReplicatedStorage").references.Satset) local SatsetBatcher = require(game:GetService("ReplicatedStorage").references.Satset.Core.Batcher) local Types = Satset.Types -- We don't call Satset.start() here an...
843
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/Booleans.luau
luau
.luau
local Buffer = require(script.Parent.lib).Buffer.Schema return Buffer.array(Buffer.boolean)
17
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/Entities.luau
luau
.luau
local Buffer = require(script.Parent.lib).Buffer.Schema return Buffer.array(Buffer.struct({ id = Buffer.u8, x = Buffer.u8, y = Buffer.u8, z = Buffer.u8, orientation = Buffer.u8, animation = Buffer.u8, }))
55
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/Mixed.luau
luau
.luau
local Buffer = require(script.Parent.lib).Buffer.Schema return Buffer.struct({ id = Buffer.u8, health = Buffer.u8, position = Buffer.vector3, velocity = Buffer.vector3, name = Buffer.string, isRunning = Buffer.boolean, animation = Buffer.u8, team = Buffer.u8, })
66
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/SingleValue.luau
luau
.luau
local Buffer = require(script.Parent.lib).Buffer.Schema return Buffer.u8
16
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/Strings.luau
luau
.luau
local Buffer = require(script.Parent.lib).Buffer.Schema return Buffer.array(Buffer.string)
17
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/Vectors.luau
luau
.luau
local Buffer = require(script.Parent.lib).Buffer.Schema return Buffer.array(Buffer.vector3)
18
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/init.luau
luau
.luau
-- Warp benchmark mode (v1.0.14 API). -- Warp uses string identifiers and separate Server/Client constructors that return event objects. local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local Benches = require(ReplicatedStorage.Shared.benches) local Warp =...
351
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/lib/Client/init.luau
luau
.luau
--!optimize 2 --!strict --@EternityDev local Client = {} local Buffer = require(script.Parent.Util.Buffer) local Replication = require(script.Parent.Replication) local Thread = require(script.Parent.Util.Thread) local Xor = require(script.Parent.Util.Xor) local RunService = game:GetService("RunService") local Event: ...
1,909
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/lib/Replication/init.luau
luau
.luau
--!optimize 2 --!strict local Replication = {} local RunService = game:GetService("RunService") local _repl: RemoteEvent = script.Parent:WaitForChild("_repl") local Buffer = require(script.Parent.Util.Buffer) local Identifier = require(script.Parent.Util.Identifier) local identifiers_schema = Buffer.Schema.string lo...
959
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/lib/Util/Identifier.luau
luau
.luau
--!optimize 2 --!strict --@EternityDev local BITS: number = 8 local MAX_VALUE: number = bit32.lshift(1, BITS) - 1 local hook_fn: (string, number) -> () if not shared.__warp_identifier_registry then shared.__warp_identifier_registry = { cache = {} :: { [string]: number }, name = {} :: { [number]: string }, count...
357
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/lib/Util/Thread.luau
luau
.luau
--!strict --!optimize 2 --@EternityDev local thread: thread? local function passer<T...>(func: (T...) -> (), ...: T...): () local HoldThread: thread = thread :: thread thread = nil func(...) thread = HoldThread end local function newThread(): () thread = coroutine.running() while true do passer(coroutine.yiel...
133
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/lib/Util/Xor.luau
luau
.luau
--!strict --!native --!optimize 2 local Xor = {} type XorEntry = { buf: buffer, len: number } local serverPrev: { [Player]: XorEntry } = {} local clientPrev: { [Player]: XorEntry } = {} local clientOutPrev: XorEntry? = nil local clientInPrev: XorEntry? = nil -- For benchmarking purpose only local debugStats = { cl...
1,207
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/warp/lib/init.luau
luau
.luau
--!strict --@EternityDev local Remote = {} if game.RunService:IsServer() then if not script:FindFirstChild("_repl") then Instance.new("RemoteEvent", script).Name = "_repl" end if not script:FindFirstChild("Event") then Instance.new("RemoteEvent", script).Name = "Event" end if not script:FindFirstChild("Unreli...
221
bookek/satset
bookek-satset-4c30f8a/benchmarks/src/shared/modes/zap.luau
luau
.luau
local RunService = game:GetService("RunService") local Benches = require(game:GetService("ReplicatedStorage").Shared.benches) local IsServer = RunService:IsServer() local Events = {} local ZapAPI if IsServer then ZapAPI = require(script.Parent.zap_gen.server) else ZapAPI = require(script.Parent.zap_gen.client) end...
181
bookek/satset
bookek-satset-4c30f8a/benchmarks/zstd/booleans.luau
luau
.luau
local fs = require("@lune/fs") local process = require("@lune/process") local FRAMES = 600 local EVENTS = 200 local VALUES = 1000 local PACKED_BYTES = math.ceil(VALUES / 8) local TEMP_INPUT = "/tmp/satset-zstd-booleans.bin" local function writeVarUInt(out: buffer, cursor: number, value: number): number while value >...
1,974
bookek/satset
bookek-satset-4c30f8a/src/Core/Batcher.luau
luau
.luau
--!native --!optimize 2 -- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details -- Batcher — handles frame-level batching, dynamic segmentation, and rate-limited flushing. local RunService = game:GetService("RunService") local Bridge = require(script.Parent...
11,096
bookek/satset
bookek-satset-4c30f8a/src/Core/Bridge.luau
luau
.luau
-- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details -- Bridge owns Satset's RemoteEvent pair. local Transport = require(script.Parent.Transport) local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunServic...
1,025
bookek/satset
bookek-satset-4c30f8a/src/Core/Guard.luau
luau
.luau
-- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details -- Guard runs Satset's server-side token bucket. local RunService = game:GetService("RunService") local IS_STUDIO = RunService:IsStudio() local DEFAULT_MAX_TOKENS = 1000 local DEFAULT_REFILL_RATE = 500...
643
bookek/satset
bookek-satset-4c30f8a/src/Core/Transport.luau
luau
.luau
-- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details export type Connection = { Disconnect: (self: Connection) -> (), } export type Transport = { sendToServer: (self: Transport, reliable: boolean, payload: buffer) -> (), sendToClient: (self: Transport...
272
bookek/satset
bookek-satset-4c30f8a/src/Networking/Group.luau
luau
.luau
-- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details local Players = game:GetService("Players") local RunService = game:GetService("RunService") local IS_SERVER = RunService:IsServer() export type Group = { add: (self: Group, player: Player) -> (), re...
560
bookek/satset
bookek-satset-4c30f8a/src/Networking/Packet.luau
luau
.luau
-- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details -- Packet — the public API for stateless, fire-and-forget networking. local Batcher = require(script.Parent.Parent.Core.Batcher) local Group = require(script.Parent.Group) local SchemaCompiler = require...
1,819
bookek/satset
bookek-satset-4c30f8a/src/Serialization/Sanitizer.luau
luau
.luau
--!native --!optimize 2 -- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details -- Sanitizer holds byte bounds and float poison checks. local Sanitizer = {} function Sanitizer.sanitizeFloat(value: number): number -- NaN check, plus Infinity for physics saf...
147
bookek/satset
bookek-satset-4c30f8a/src/Serialization/SchemaCompiler.luau
luau
.luau
--!optimize 2 -- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details -- SchemaCompiler — transforms a schema dictionary into a deterministic ordered structure. local Types = require(script.Parent.Parent.Types) -- [ Types ] export type FieldDef = { name: ...
1,770
bookek/satset
bookek-satset-4c30f8a/src/Serialization/Serializer.luau
luau
.luau
--!native --!optimize 2 -- This file is part of the Satset networking library and is licensed under MIT License; see LICENSE.txt for details -- Serializer moves schema data in and out of buffers. local Sanitizer = require(script.Parent.Sanitizer) local SchemaCompiler = require(script.Parent.SchemaCompiler) local Seri...
928
bookek/satset
bookek-satset-4c30f8a/tests/MockTransport.luau
luau
.luau
type Listener = { callback: (...any) -> (), connected: boolean, } type ListenerSet = { reliable: { Listener }, unreliable: { Listener }, } type ClientState = { listeners: ListenerSet, connected: boolean, } export type Connection = { Disconnect: (self: Connection) -> (), } export type MockNetwork = { server:...
748
bookek/satset
bookek-satset-4c30f8a/tests/transport.luau
luau
.luau
local MockTransport = require("./MockTransport") local Transport = require("../src/Core/Transport") local invalidOk, invalidError = pcall(Transport.assertValid, {}) assert( not invalidOk and string.find(tostring(invalidError), "sendToServer", 1, true) ~= nil, "transport validation accepted an incomplete transport" )...
674
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/.lune/test-lib/assertEq.luau
luau
.luau
-- see .lune/test.luau -- selene: allow(unused_variable) return function<T>(value: T, expected: T): boolean return nil :: any end
39
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/.lune/test-lib/describe.luau
luau
.luau
-- see .lune/test.luau -- selene: allow(unused_variable) return function(name: string, fn: () -> ()) end
31
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/.lune/test-lib/randomTuple.luau
luau
.luau
-- see .lune/test.luau export type TupleFunctions = { map: (...any) -> ...any, other: () -> ...any, assertEq: (...any) -> (), assertEqMapped: (...any) -> (), assertEqOther: (...any) -> (), assertEqOtherMapped: (...any) -> (), } -- selene: allow(unused_variable) return function(f: (tuple: TupleFunctions, ...any)...
100
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/future/lib.luau
luau
.luau
local Option = require("../option/lib") local std = require("../std/lib") local threadpool = require("../threadpool/lib") local task = std.task export type Future<T> = typeof(setmetatable( {} :: { _f: boolean, _v: T, _w: { thread }, _c: { (T) -> () }, }, {} :: FutureImpl )) export type FutureImpl = { __i...
1,250
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/future/lib.test.luau
luau
.luau
local assertEq = require("@testing/assertEq") local describe = require("@testing/describe") local test = require("@testing/test") local task = require("@lune/task") local Future = require("./lib") describe("new", function() test("creates a finished future with the given value", function() local fut = Future.new(5...
1,289
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/option/lib.luau
luau
.luau
export type Option<T...> = typeof(setmetatable( {} :: { -- value to "store" T... -- this value doesn't exist at runtime, and is only used for typechecking _T: (T...) -> (), _n: number, }, {} :: OptionImpl )) export type OptionImpl = { __index: OptionImpl, __tostring: <T0...>(self: Option<T0...>) -> strin...
3,706
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/option/lib.test.luau
luau
.luau
local stdio = require("@lune/stdio") local assertEq = require("@testing/assertEq") local describe = require("@testing/describe") local randomTuple = require("@testing/randomTuple") local test = require("@testing/test") local Option = require("./lib") describe("Some", function() test("returns an option containing th...
3,001
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/result/lib.luau
luau
.luau
export type Result<T, E> = typeof(setmetatable( {} :: { _ok: boolean, _v: T, _e: E, }, {} :: ResultImpl )) export type ResultImpl = { __index: ResultImpl, __tostring: <T, E>(self: Result<T, E>) -> string, __eq: <T, E>(self: Result<T, E>, other: Result<T, E>) -> boolean, Ok: <T>(value: T) -> Result<T, any...
2,538
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/result/lib.test.luau
luau
.luau
local stdio = require("@lune/stdio") local assertEq = require("@testing/assertEq") local describe = require("@testing/describe") local test = require("@testing/test") local Result = require("./lib") describe("Ok", function() test("returns a result containing the given Ok value", function() local result = Result.O...
2,999
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/std/default-runtimes/lune.luau
luau
.luau
local runtime = require("../runtime") local task = require("@lune/task") return runtime.defineRuntime({ name = "lune", libs = { task = { cancel = task.cancel, defer = task.defer, delay = task.delay, spawn = task.spawn, wait = task.wait, }, }, })
72
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/std/default-runtimes/roblox.luau
luau
.luau
local runtime = require("../runtime") return runtime.defineRuntime({ name = "roblox", libs = { task = { cancel = task.cancel, defer = task.defer, delay = task.delay, spawn = task.spawn, wait = task.wait, } :: any, }, })
66
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/std/lib.luau
luau
.luau
local libs = require("./libs") local runtime = require("./runtime") export type Runtime = runtime.Runtime export type RuntimeDefinition = runtime.RuntimeDefinition export type TaskLib = libs.TaskLib local std = {} local function detectRuntime(): Runtime? if _G.UTIL_TARGET == "roblox" then return require("./defau...
276
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/std/lib.test.luau
luau
.luau
local assertEq = require("@testing/assertEq") local describe = require("@testing/describe") local test = require("@testing/test") local std = require("./lib") describe("detectRuntime", function() test("detects lune runtime", function() assertEq(std.runtime ~= nil, true) assert(std.runtime ~= nil, "make Luau typ...
281
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/std/libs.luau
luau
.luau
local libs = {} export type TaskLib = { cancel: (thread) -> (), defer: <T...>(functionOrThread: thread | (T...) -> (), T...) -> thread, delay: <T...>(duration: number, functionOrThread: thread | (T...) -> (), T...) -> thread, spawn: <T...>(functionOrThread: thread | (T...) -> (), T...) -> thread, wait: (duration:...
191
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/std/runtime.luau
luau
.luau
local libs = require("./libs") export type Runtime = { name: string, libs: { task: libs.TaskLib, }, } export type RuntimeDefinition = { name: string, libs: { task: { cancel: ((thread) -> ())?, defer: (<T...>(functionOrThread: thread | (T...) -> (), T...) -> thread)?, delay: (<T...>(duration: number,...
351
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/threadpool/lib.luau
luau
.luau
local std = require("../std/lib") local task = std.task local threadpool = {} local freeThreads: { thread } = {} local function run<T...>(f: (T...) -> (), thread: thread, ...) f(...) table.insert(freeThreads, thread) end local function yielder() while true do run(coroutine.yield()) end end --[=[ Executes t...
182
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/threadpool/lib.test.luau
luau
.luau
local assertEq = require("@testing/assertEq") local describe = require("@testing/describe") local test = require("@testing/test") local threadpool = require("./lib") describe("spawn", function() test("executes the functions in a thread", function() local count = 0 local function f(v) assertEq(v, 10) count ...
255
lukadev-0/util.luau
lukadev-0-util.luau-534e2fc/packages/timer/lib.luau
luau
.luau
local Future = require("../future/lib") local std = require("../std/lib") local threadpool = require("../threadpool/lib") local task = std.task local timer = {} function timer.delay(duration: number): Future.Future<number> return Future.spawn(task.wait, duration) end function timer.interval<T...>(duration: number,...
170
wakatime/roblox-studio-wakatime
wakatime-roblox-studio-wakatime-354aa91/src/init.server.luau
luau
.luau
local MarketplaceService = game:GetService("MarketplaceService") local RunService = game:GetService("RunService") local ScriptEditorService = game:GetService("ScriptEditorService") local Selection = game:GetService("Selection") local StudioService = game:GetService("StudioService") local UserInputService = game:GetServ...
619
wakatime/roblox-studio-wakatime
wakatime-roblox-studio-wakatime-354aa91/src/storageHandler.luau
luau
.luau
local util = require(script.Parent.util) local module = {} local projectSettingKey = `WakaTimeProject_{game.GameId}` function module.setProjectName(plugin: Plugin, value: string) value = util.trimString(value) -- Setting the project name to "" is a valid state, used for marking that it should be purposefully not sen...
536
wakatime/roblox-studio-wakatime
wakatime-roblox-studio-wakatime-354aa91/src/uiHandler.luau
luau
.luau
local React = require(script.Parent.Packages.React) local ReactRoblox = require(script.Parent.Packages.ReactRoblox) local StudioComponents = require(script.Parent.Packages.StudioComponents) local storageHandler = require(script.Parent.storageHandler) local util = require(script.Parent.util) local e = React.createElemen...
1,659
wakatime/roblox-studio-wakatime
wakatime-roblox-studio-wakatime-354aa91/src/util.luau
luau
.luau
local module = {} function module.instanceToPath(instance: Instance): string local path local parent = instance while parent do local name = if parent == game then "game" else parent.Name path = if path then `{name}/{path}` else name parent = parent.Parent end return path end function module.trimString(s...
322
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/packages/png/src/crc32.luau
luau
.luau
--!strict --!native --!optimize 2 local LOOKUP = buffer.create(0x1000) for index = 0, 0xFF do local crc = index for _ = 1, 8 do crc = crc % 2 == 1 and bit32.bxor(crc // 2, 0xEDB88320) or crc // 2 end buffer.writeu32(LOOKUP, index * 4, crc) end for index = 0, 0xFF do local crc = buffer.readu32(LOOKUP, index *...
529
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/packages/png/src/encode.luau
luau
.luau
--!strict --!optimize 2 local types = require("./types") export type EncodeErrorCode = | "unsupported" export type EncodeError = types.Error<EncodeErrorCode> return function(): (nil, EncodeError) return nil, {code = "unsupported", message = "PNG encoding is currently unsupported"} end
67
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/packages/png/src/init.luau
luau
.luau
--!strict --!optimize 2 local types = require("@self/types") local decode = require("@self/decode") local encode = require("@self/encode") export type ColorSpace = types.ColorSpace export type CriticalChunk = types.CriticalChunk export type AncillaryChunk = types.AncillaryChunk export type Chunk = types.Chunk export...
172
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/packages/png/src/types.luau
luau
.luau
--!strict --!optimize 2 export type Error<Code> = { code: "ok", message: "", } | { code: Code, message: string, } export type ColorSpace = "truecolor" | "grayscale" | "indexed" export type DisposeOperation = "none" | "background" | "previous" export type BlendOperation = "source" | "over" export type CriticalCh...
248
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/packages/png/src/zlib.luau
luau
.luau
--!strict --!native --!optimize 2 local types = require("./types") export type DecompressErrorCode = | "unsupported" | "unexpected_eof" | "invalid_length" | "invalid_header" | "invalid_block" export type DecompressError = types.Error<DecompressErrorCode> local function ok(): {code: "ok", message: ""} return {c...
3,296
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/packages/png/tests/conformance/pngsuite.test.luau
luau
.luau
local testing = zune.testing local crypto = zune.crypto local serde = zune.serde local fs = zune.fs local png = require("../../src") local PNGSUITE_DIR = "packages/png/tests/fixtures/pngsuite" local HASHES: {[string]: {string}} = serde.json.decode(fs.readFile(`{PNGSUITE_DIR}/hashes.json`, false)) local function get_...
495
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/packages/png/tests/test.luau
luau
.luau
local testing = zune.testing testing.describe("png", function() require("./conformance/pngsuite.test") require("./unit/crc32.test") end) return nil
35
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/packages/png/tests/unit/crc32.test.luau
luau
.luau
local testing = zune.testing local crc32 = require("../../src/crc32") testing.describe("crc32", function() testing.test("matches standard checksum", function() testing.expect(crc32(buffer.fromstring("123456789"), 0, 9)).toBe(0xCBF43926) end) end) return nil
72
wizevaxel/picguin
wizevaxel-picguin-c3d33ca/scripts/build.luau
luau
.luau
local PACKAGES_DIR = "packages" local RELEASES_DIR = "release" local function release() local codec = assert(zune.process.args[2], "no codec provided") local package_dir = `{PACKAGES_DIR}/{codec}` assert(zune.fs.stat(package_dir).kind ~= "none", "codec not found in packages") zune.fs.makeDir(RELEASES_DIR, tru...
178