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
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/squircle.luau
luau
.luau
--!nocheck --!nolint --/INLINE -- Penumbra: Fragment Shader - Mini: Squircle [Source: https://www.shadertoy.com/view/WcGXRD] local function main( fragColor:vec, fragCoord:vec, iTime:f64 ):vec --//Centered and scale to fit vertically local p:vec = (fragCoord*2.-iRes)/iRes.y --//Distance to squircle (squared-radius of...
307
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/squircle2.luau
luau
.luau
--!nocheck --!nolint --/INLINE -- Penumbra: Fragment Shader - Mini: Squircle 2 [Source: https://www.shadertoy.com/view/WfySDD] local function mat2(v:vec,a:f64,b:f64,c:f64,d:f64):vec return vec(a*v.x+b*v.y,c*v.x+d*v.y)end local function main( fragColor:vec, fragCoord:vec, iTime:f64 ):vec --//Centered and scale to fit v...
516
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/pipeline/shader_src/frag/tracedtunnel.luau
luau
.luau
--!nocheck --!nolint --/INLINE -- Penumbra: Fragment Shader - Traced Tunnel [Source: https://www.shadertoy.com/view/tdjfDR] local iChannel0: Textures.Texture = Textures.Load.Base( {{Name="Squared"},{Name="VFlip"},{Name="GaussianBlur"}}, "abstract3" ) local iChannel1: Textures.Texture = Textures.Load.Base( {{Name="Squar...
2,872
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/pipeline/shaders/filter/README.luau
luau
.luau
-- Populate this directory with shader modules by using builder/init.luau!
14
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/pipeline/shaders/multi.luau
luau
.luau
--!nocheck --!nolint -- Multi-shader wrapper module -- Calls multiple different modules based on os.clock() -- Shaders local ShaderList = { require( "./frag/cardgame" ), require( "./frag/cave" ), require( "./frag/cloudytunnel" ), require( "./frag/rocaille" ), require( "./frag/fractalpyramid" ), require( "./frag...
191
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/pipeline/types.luau
luau
.luau
-- Pipeline : Types -- local Textures = require(`../textures`) export type Shader = { -- Shader needs its own write buffer due to temporal accumulation. read FB_Slice_Write: buffer, read Run: ShaderModule } export type ShaderModule = ( T: number, Sync_FB_Slice_Read: buffer, FB_Slice_Write: buffer, --Out: buffer...
164
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/ChunkTypes.luau
luau
.luau
local Types = require("./Types") export type IHDR = { width: number, height: number, bitDepth: number, colorType: number, interlaced: boolean, } export type PLTE = { colors: { Types.Color }, } export type tRNS = { gray: number, red: number, green: number, blue: number, } return {}
82
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/HuffmanTable.luau
luau
.luau
--!strict --!native local function new(lengths: { number }) local blCount = {} local maxBits = 0 for _, len in lengths do if len > 0 then blCount[len] = (blCount[len] or 0) + 1 if len > maxBits then maxBits = len end end end local thisCode = 1 local nextCode = {} for bits = 1, maxBits do thi...
253
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/Types.luau
luau
.luau
export type PNG = { Width: number, Height: number, Pixels: buffer, --ReadPixel: (x: number, y: number) -> Color, } export type Chunk = { type: string, offset: number, length: number, } export type Color = { r: number, g: number, b: number, a: number, } return {}
80
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/chunks/IHDR.luau
luau
.luau
--!strict --!native local ChunkTypes = require("../ChunkTypes") local Types = require("../Types") local COLOR_TYPE_BIT_DEPTH = { [0] = { 1, 2, 4, 8, 16 }, [2] = { 8, 16 }, [3] = { 1, 2, 4, 8 }, [4] = { 8, 16 }, [6] = { 8, 16 }, } local function read(buf: buffer, chunk: Types.Chunk): ChunkTypes.IHDR assert(chun...
415
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/chunks/PLTE.luau
luau
.luau
--!strict --!native local ChunkTypes = require("../ChunkTypes") local Types = require("../Types") local function read(buf: buffer, chunk: Types.Chunk, header: ChunkTypes.IHDR): ChunkTypes.PLTE assert(chunk.length % 3 == 0, "malformed PLTE chunk") local count = chunk.length / 3 assert(count > 0, "no entries in PLT...
223
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/chunks/init.luau
luau
.luau
--!strict --!native return { IHDR = require("@self/IHDR"), PLTE = require("@self/PLTE"), tRNS = require("@self/tRNS"), }
42
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/chunks/tRNS.luau
luau
.luau
--!strict --!native local ChunkTypes = require("../ChunkTypes") local Types = require("../Types") local function readU16(buf: buffer, offset: number, depth: number) return bit32.extract( bit32.bor(bit32.lshift(buffer.readu8(buf, offset), 8), buffer.readu8(buf, offset + 1)), 0, depth ) end local function read...
396
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/crc32.luau
luau
.luau
--!strict --!native -- stylua: ignore local lookup = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4E...
2,335
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/png/inflate.luau
luau
.luau
--!strict --!native local HuffmanTable = require("./HuffmanTable") -- stylua: ignore local LIT_LEN = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, } -- stylua: ignore local LIT_EXTRA = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3,...
1,948
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/16x16_test.luau
luau
.luau
--!strict --!native local B64 = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIElEQVQokWP4z8Dw//9/BuJJ0lRDwKgNozYMBRv+MwAA53OAjjUvXLcAAAAASUVORK5CYII=" return buffer.fromstring(B64)
109
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/cubemaps/flatday/flatday.luau
luau
.luau
--!strict --!native local B64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAFDmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9...
1,718
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/cubemaps/flatday/flatday_bk.luau
luau
.luau
--!strict --!native return require( "./flatday" )
16
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/cubemaps/zero/zero.luau
luau
.luau
--!strict --!native local B64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAFDmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9...
1,728
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/cubemaps/zero/zero_bk.luau
luau
.luau
--!strict --!native return require( "./zero" )
15
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/assets/font_codepage437.luau
luau
.luau
--!strict --!native local B64 = "iVBORw0KGgoAAAANSUhEUgAACQAAAAAOCAIAAAD1rrSwAAAACXBIWXMAAAsTAAALEwEAmpwYAAAPBklEQVR4nO1dW5IjsarUOXHX6EV6lefDcStoHslD1MMe8qOjuiRQCiFAsnvmP+tH8X6/1fev16tdajB4Gj6ePH47GAwGA4r3+51NDZNQBoPBP4XjPKjGvQmJgxSoO43zYNAS5Xj+PKg/F7Hq8UzNCwxeaGIj7q8jUFgbq6ywNqOaeWsKe2lcafmLpZ7gvYDGxWMVDKsCaKBSwW4YkyA...
3,755
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/init.luau
luau
.luau
--!strict --!native --[[ Penumbra: textures.luau This module handles loading and processing a texture via any of the given load parameters by the calling module. Assets are stored via textures/assets, additional ones can be added by providing PNG files as base64-encoded strings so that no filesystem dependen...
4,127
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/lib/textures/types.luau
luau
.luau
-- Types : Textures -- -- Represents what constitutes as a texture. export type Texture = { [number]: vector, read Buffer: buffer, read Dimensions: vector, read Width: number, read Height: number, read Width0: number, read Height0: number, read FD: vector, read Mult: vector | number } -- A super...
164
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/license/base64.luau
luau
.luau
--[[ MIT License Copyright (c) 2025 daily3014 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, di...
223
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/license/penumbra.luau
luau
.luau
--[[ The MIT License (MIT) Copyright (c) 2026 Crazyblox Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
226
Crazyblox/penumbra
Crazyblox-penumbra-f730e0d/license/png.luau
luau
.luau
--[[ The MIT License (MIT) Copyright (c) 2024 sircfenner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, ...
227
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/lune/Context/DateTime.luau
luau
.luau
--!strict --[[ Lune's `datetime` module uses lowerCamelCase, whereas Roblox's `DateTime` module uses UpperCamelCase. To allow for Roblox-style usage of DateTime objects, this module wraps Lune's `datetime` module to add Roblox-style properties and methods through the use of metatables. This module may need to be ...
164
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/lune/Context/Debug.luau
luau
.luau
--!strict --[[ Jest depends on `loadmodule` existing on the `debug` api. On Roblox, it's locked behind a feature flag FFlagDebugLoadModule, which is not enabled by default. In Lune, it doesn't exist at all, so this module creates the interface for it but is not implemented. The _loader function needs to be overrid...
162
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/lune/Utils/Path.luau
luau
.luau
--!strict --[[ Paths use \ on Windows and / on Unix. Lune doesn't have a built-in path assembler, so this script is used to provide a consistent path format for all platforms. --]] local process = require("@lune/process") local Path = {} function Path.join(...) local path = table.concat({ ... }, "/") if process...
101
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/lune/Utils/ReducedInstance.luau
luau
.luau
--!strict --[[ Lune instances are tables containing a reference to the instance, but Lune creates different tables even for the same instance. Jest's caching behavior depends on the instance always being the same to look it up by key, so this function serves to always return the same "wrapped" instance when given ...
464
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/lune/Utils/Runtime.luau
luau
.luau
--!strict --[[ Provides a connection to a loop that runs every frame. This is used in the custom Heartbeat implementation in lune/test.luau --]] local task = require("@lune/task") type Listener = { callback: (number) -> (), disconnected: boolean, } local Runtime = {} Runtime._running = false Runtime._listeners ...
288
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/lune/Utils/runShellScript.luau
luau
.luau
--[[ On Unix-like systems, shell scripts can be run directly. On Windows, shell scripts need to be run by calling a shell executable, such as Git Bash. This script assumes the Windows machine has a shell runner installed and available in the PATH. - For example, Git Bash can be installed and C:\Program Files\Git\b...
161
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/lune/build.luau
luau
.luau
--!strict --[[ Builds the release artifacts of the finite state machine. Used by CI to upload to various release targets. Since the parent folder is named `lune`, the `lune` cli will automatically look in this directory for scripts to run. Usage (from project directory): lune run build 0-0-0 Where 0-0-0 is th...
654
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/lune/test.luau
luau
.luau
--!strict --[[ Lune script to run tests on a given project.json file. By default, it uses `test.project.json`, but can be passed a different file as an argument. Since the parent folder is named `lune`, the `lune` cli will automatically look in this directory for scripts to run. Usage (from project directory): ...
1,477
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/src/StateQ/Modules/Signal.luau
luau
.luau
--!strict -------------------------------------------------------------------------------- -- Batched Yield-Safe Signal Implementation -- -- This is a Signal class which has effectively identical behavior to a -- -- normal RBXScriptSignal, with the only difference being a couple...
1,253
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/src/StateQ/Modules/ThreadQueue.luau
luau
.luau
--!strict --[[ ThreadQueue is a task scheduler and rate limiter that allows callbacks to be queued to be executed, yielding the requesting thread until the callback has returned. Provides similar functionality to the NodeJS module Bottleneck (https://www.npmjs.com/package/bottleneck) however, it exposes its sched...
781
BusyCityGuy/finite-state-machine-luau
BusyCityGuy-finite-state-machine-luau-156db58/src/TestService/Source/run.server.luau
luau
.luau
local TestService = game:GetService("TestService") local Jest = require(TestService.Source.DevPackages.Jest) local runCLI = Jest.runCLI -- Jest.TestBootstrap:run({ TestService.Source.Tests }) print("Checking for ProcessService...") local processServiceExists, ProcessService = pcall(function() -- selene: allow(incor...
237
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/init.luau
luau
.luau
--!native --!optimize 2 -- stylua: ignore local HEX_TO_BINARY = { ["0"] = "0000", ["1"] = "0001", ["2"] = "0010", ["3"] = "0011", ["4"] = "0100", ["5"] = "0101", ["6"] = "0110", ["7"] = "0111", ["8"] = "1000", ["9"] = "1001", ["a"] = "1010", ["b"] = "1011", ["c"] = "1100", ["d"] = "1101", ["e"] = "1110...
6,996
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/lune/verify-package.luau
luau
.luau
local fs = require("@lune/fs") local serde = require("@lune/serde") local wally = serde.decode("toml", fs.readFile("wally.toml")) local npm = serde.decode("json", fs.readFile("package.json")) local wally_name = wally.package.name local npm_name = string.match(npm.name, "^@(%w+/%w+)$") assert(npm_name == wally_name, "...
420
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/test.luau
luau
.luau
local t1 = os.clock() require("./tests/basic") local d1 = os.clock() - t1 print(string.format("Basic competency tests finished in %.3fs", d1)) local t2 = os.clock() require("./tests/bitwise/standard") require("./tests/bitwise/rshift") require("./tests/bitwise/arshift") require("./tests/bitwise/rrotate") require("./tes...
192
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/arithmetic/add.luau
luau
.luau
local int64 = require("../../") local max = int64.from_pair(0xFFFFFFFF, 0xFFFFFFFF) local zero = int64.from_u32(0) local one = int64.from_u32(1) local added_max = int64.add(max, max) assert(int64.to_hex_string(added_max) == "fffffffffffffffe", "max value + max value was not correct") assert(added_max.x == 0b111111111...
891
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/arithmetic/mult.luau
luau
.luau
local int64 = require("../../") local test_1_a = int64.mult(int64.from_pair(0, 3), int64.from_pair(0, 5)) assert(int64.to_hex_string(test_1_a) == "000000000000000f", "test 1 a (3 * 5) failed") local test_1_b = int64.mult(int64.from_pair(0, 5), int64.from_pair(0, 3)) assert(int64.to_hex_string(test_1_b) == "00000000000...
2,115
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/arithmetic/pow.luau
luau
.luau
local int64 = require("../../") local test_1 = int64.pow(int64.from_pair(0, 3), 4) assert(int64.to_hex_string(test_1) == "0000000000000051", "pow test 1 (3 ^ 4) failed") local test_2 = int64.pow(int64.from_pair(0, 5), 1) assert(int64.to_hex_string(test_2) == "0000000000000005", "pow test 2 (5 ^ 1) failed") local tes...
1,190
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/arithmetic/sub.luau
luau
.luau
local int64 = require("../../") local max = int64.from_pair(0xFFFFFFFF, 0xFFFFFFFF) local zero = int64.from_u32(0) local one = int64.from_u32(1) local subbed_max = int64.sub(max, max) assert(int64.to_hex_string(subbed_max) == "0000000000000000", "max value - max value was not correct") assert(subbed_max.x == 0b000000...
1,143
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/basic.luau
luau
.luau
local int64 = require("../") local PADDING_STRING = "\a\b\f\n\r\t\v\255\69\127" -- Constants assert(int64.ZERO.x == 0, "int64.ZERO x component was wrong") assert(int64.ZERO.y == 0, "int64.ZERO y component was wrong") assert(int64.ZERO.z == 0, "int64.ZERO z component was wrong") assert(int64.ONE.x == 0, "int64.ONE x...
9,323
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/bitwise/arshift.luau
luau
.luau
local int64 = require("../../") local arshift_n = int64.from_pair(0x80000000, 0x00000000) for i = 0, 63 do local new = int64.arshift(arshift_n, i) local expected_bin = string.rep("1", i) .. "1" .. string.rep("0", 63 - i) assert(int64.to_bin_string(new) == expected_bin, `{int64.to_hex_string(arshift_n)} >> {i} was w...
4,117
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/bitwise/lrotate.luau
luau
.luau
local int64 = require("../../") local lrotate_n = int64.from_pair(0x80000000, 0x00000000) assert(int64.lrotate(lrotate_n, 0) == lrotate_n, `{int64.to_hex_string(lrotate_n)} LROT 0 was wrong`) for i = 1, 63 do local new = int64.lrotate(lrotate_n, i) local expected_bin = string.rep("0", 64 - i) .. "1" .. string.rep("...
4,258
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/bitwise/lshift.luau
luau
.luau
local int64 = require("../../") local lshift_n = int64.from_pair(0x00000000, 0x00000001) for i = 0, 63 do local new = int64.lshift(lshift_n, i) local expected_bin = string.rep("0", 63 - i) .. "1" .. string.rep("0", i) assert(int64.to_bin_string(new) == expected_bin, `{int64.to_hex_string(lshift_n)} << {i} was wrong...
8,211
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/bitwise/rrotate.luau
luau
.luau
local int64 = require("../../") local rrotate_n = int64.from_pair(0x80000000, 0x00000000) for i = 0, 63 do local new = int64.rrotate(rrotate_n, i) local expected_bin = string.rep("0", i) .. "1" .. string.rep("0", 63 - i) assert(int64.to_bin_string(new) == expected_bin, `{int64.to_hex_string(rrotate_n)} RROT {i} was...
4,229
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/bitwise/rshift.luau
luau
.luau
local int64 = require("../../") local rshift_n = int64.from_pair(0x80000000, 0x00000000) for i = 0, 63 do local new = int64.rshift(rshift_n, i) local expected_bin = string.rep("0", i) .. "1" .. string.rep("0", 63 - i) assert(int64.to_bin_string(new) == expected_bin, `{int64.to_hex_string(rshift_n)} >>< {i} was wron...
5,857
Dekkonot/int64-luau
Dekkonot-int64-luau-afa518a/tests/bitwise/standard.luau
luau
.luau
local int64 = require("../../") local band_1 = int64.band(int64.from_pair(0, 0), int64.from_pair(0, 0)) assert(int64.to_hex_string(band_1) == "0000000000000000", "band_1 was wrong") local band_2 = int64.band(int64.from_pair(0, 1), int64.from_pair(0, 1)) assert(int64.to_hex_string(band_2) == "0000000000000001", "band_...
3,638
Nicell/alien-signals-luau
Nicell-alien-signals-luau-db7a368/benchmarks/bench.luau
luau
.luau
return function(name: string, test: () -> ()) local start = os.clock() local iter = 0 while os.clock() - start < 2 do iter += 1 test() end local endTime = os.clock() local elapsed = endTime - start print(`{name}: {elapsed / iter * 1000 * 1000} us/iter`) end
82
Nicell/alien-signals-luau
Nicell-alien-signals-luau-db7a368/benchmarks/complex.luau
luau
.luau
local signals = require("../src") local bench = require("./bench") local computed = signals.computed local effect = signals.effect local signal = signals.signal local dimensions = { 1, 10, 100 } for _, w in dimensions do for _, h in dimensions do bench(`propagate: {w} * {h}`, function() local src, setSrc = sig...
184
Nicell/alien-signals-luau
Nicell-alien-signals-luau-db7a368/benchmarks/propagate.luau
luau
.luau
local signals = require("../src") local bench = require("./bench") local computed = signals.computed local effect = signals.effect local signal = signals.signal local dimensions = { 1, 10, 100 } for _, w in dimensions do for _, h in dimensions do bench(`propagate: {w} * {h}`, function() local src, setSrc = sig...
168
Nicell/alien-signals-luau
Nicell-alien-signals-luau-db7a368/src/init.luau
luau
.luau
local system = require("@self/system") local createReactiveSystem = system.createReactiveSystem local SubscriberFlags = system.SubscriberFlags type Subscriber = system.Subscriber type Dependency = system.Dependency type SubscriberFlags = system.SubscriberFlags local Computed = SubscriberFlags.Computed local Effect =...
1,319
Nicell/alien-signals-luau
Nicell-alien-signals-luau-db7a368/src/system.luau
luau
.luau
export type Dependency = { subs: Link?, subsTail: Link?, } export type Subscriber = { flags: SubscriberFlags, deps: Link?, depsTail: Link?, } export type Link = { dep: Dependency | (Dependency & Subscriber), sub: Subscriber | (Dependency & Subscriber), prevSub: Link?, nextSub: Link?, nextDep: Link?, } type...
2,979
Nicell/alien-signals-luau
Nicell-alien-signals-luau-db7a368/tests/init.luau
luau
.luau
require("@self/computed.spec") require("@self/effect.spec") require("@self/effectScope.spec") require("@self/untrack.spec") require("@self/issue_48.spec") require("@self/topology.spec") print("All tests passed!")
51
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/equals.lua
luau
.lua
local equalObjects = require(script.Parent.Parent.equalObjects) local function compare(a, b) if type(a) ~= "table" or type(b) ~= "table" then return a == b end for key, value in a do if b[key] ~= value then return false end end for key, value in b do if a[key] ~= value then return false end end...
193
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/filter.lua
luau
.lua
--!strict --[=[ Returns a Dictionary of only entries for which the `predicate` function returns true. ]=] local function filter<K, V>(dictionary: { [K]: V }, predicate: ((V, K) -> boolean)): { [K]: V } local new = {} for k, v in dictionary do if predicate(v, k) then new[k] = v end end return new end ret...
96
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/init.lua
luau
.lua
--[[ Defines utilities for working with 'dictionary-like' tables. Dictionaries can be indexed by any value, but don't have the ordering expectations that lists have. ]] return { equals = require(script.equals), filter = require(script.filter), join = require(script.join), keys = require(script.keys), map = re...
92
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/join.lua
luau
.lua
local None = require(script.Parent.Parent.None) --[[ Combine a number of dictionary-like tables into a new table. Keys specified in later tables will overwrite keys in previous tables. Use `Cryo.None` as a value to remove a key. This is necessary because Lua does not distinguish between a value not being present...
235
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/keys.lua
luau
.lua
--[[ Returns a list of the keys from the given dictionary. ]] local function keys(dictionary) local new = {} local index = 1 for key in pairs(dictionary) do new[index] = key index = index + 1 end return new end return keys
62
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/map.lua
luau
.lua
--!strict --[=[ Returns a new Dictionary with keys and values passed through a mapper function. Returning a second value in the mapper function will reassign the key. ]=] local function map<K, V, K2, V2>(collection: { [K]: V }, mapper: (V, K) -> (V2, K2?)): { [K2]: V2 } local new = {} for key, value in collectio...
161
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/omit.lua
luau
.lua
--!strict --[=[ Returns a Dictionary which excludes the given `keys`. ]=] local function omit<K, V>(dictionary: { [K]: V }, ...: K): { [K]: V } local new = table.clone(dictionary) for _, key in { ... } do new[key] = nil end return new end return omit
76
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/union.lua
luau
.lua
--!strict local function union<T, U>(dictionary1: T, dictionary2: U): T & U local new: any = table.clone(dictionary1 :: any) for key, value in dictionary2 :: any do new[key] = value end return new end return union
65
Roblox/cryo
Roblox-cryo-94044ed/src/Dictionary/values.lua
luau
.lua
--[[ Returns a list of the values of the given dictionary. ]] local function values(dictionary) local new = {} local index = 1 for _, value in pairs(dictionary) do new[index] = value index = index + 1 end return new end return values
63
Roblox/cryo
Roblox-cryo-94044ed/src/List/equals.lua
luau
.lua
local equalObjects = require(script.Parent.Parent.equalObjects) local function compare(a, b) if type(a) ~= "table" or type(b) ~= "table" then return a == b end if #a ~= #b then return false end for i = 1, #a do if a[i] ~= b[i] then return false end end return true end local function equals<T>(......
180
Roblox/cryo
Roblox-cryo-94044ed/src/List/filter.lua
luau
.lua
--[[ Create a copy of a list with only values for which `callback` returns true. Calls the callback with (value, index). ]] local function filter(list, callback) local new = {} local index = 1 for i = 1, #list do local value = list[i] if callback(value, i) then new[index] = value index = index + 1 end...
101
Roblox/cryo
Roblox-cryo-94044ed/src/List/filterMap.lua
luau
.lua
--[[ Create a copy of a list doing a combination filter and map. If callback returns nil for any item, it is considered filtered from the list. Any other value is considered the result of the 'map' operation. ]] local function filterMap(list, callback) local new = {} local index = 1 for i = 1, #list do local ...
121
Roblox/cryo
Roblox-cryo-94044ed/src/List/find.lua
luau
.lua
--[[ Returns the index of the first value found or nil if not found. ]] local function find(list, value) for i = 1, #list do if list[i] == value then return i end end return nil end return find
60
Roblox/cryo
Roblox-cryo-94044ed/src/List/findWhere.lua
luau
.lua
--[[ Returns the index of the first value for which predicate(value, index) is truthy, or nil if not found. ]] local function findWhere(list, predicate) for i = 1, #list do if predicate(list[i], i) then return i end end return nil end return findWhere
73
Roblox/cryo
Roblox-cryo-94044ed/src/List/foldLeft.lua
luau
.lua
--[[ Performs a left-fold of the list with the given initial value and callback. ]] local function foldLeft(list, callback, initialValue) local accum = initialValue for i = 1, #list do accum = callback(accum, list[i], i) end return accum end return foldLeft
69
Roblox/cryo
Roblox-cryo-94044ed/src/List/foldRight.lua
luau
.lua
--[[ Performs a right-fold of the list with the given initial value and callback. ]] local function foldRight(list, callback, initialValue) local accum = initialValue for i = #list, 1, -1 do accum = callback(accum, list[i], i) end return accum end return foldRight
72
Roblox/cryo
Roblox-cryo-94044ed/src/List/getRange.lua
luau
.lua
--[[ Returns a new list containing only the elements within the given range. ]] local function getRange(list, startIndex, endIndex) assert(startIndex <= endIndex, "startIndex must be less than or equal to endIndex") local new = {} local index = 1 for i = math.max(1, startIndex), math.min(#list, endIndex) do n...
99
Roblox/cryo
Roblox-cryo-94044ed/src/List/init.lua
luau
.lua
--[[ Defines utilities for working with 'list-like' tables. ]] return { equals = require(script.equals), filter = require(script.filter), filterMap = require(script.filterMap), find = require(script.find), findWhere = require(script.findWhere), foldLeft = require(script.foldLeft), foldRight = require(script.fo...
146
Roblox/cryo
Roblox-cryo-94044ed/src/List/join.lua
luau
.lua
local None = require(script.Parent.Parent.None) --[[ Joins any number of lists together into a new list ]] local function join(...) local new = {} for listKey = 1, select("#", ...) do local list = select(listKey, ...) local len = #new for itemKey = 1, #list do if list[itemKey] == None then len = len ...
122
Roblox/cryo
Roblox-cryo-94044ed/src/List/map.lua
luau
.lua
--[[ Create a copy of a list where each value is transformed by `callback` ]] local function map(list, callback) local new = {} for i = 1, #list do new[i] = callback(list[i], i) end return new end return map
60
Roblox/cryo
Roblox-cryo-94044ed/src/List/removeIndex.lua
luau
.lua
--[[ Remove the element at the given index. ]] local function removeIndex(list, index) local new = {} local removed = 0 for i = 1, #list do if i == index then removed = 1 else new[i - removed] = list[i] end end return new end return removeIndex
81
Roblox/cryo
Roblox-cryo-94044ed/src/List/removeRange.lua
luau
.lua
--[[ Remove the range from the list starting from the index. ]] local function removeRange(list, startIndex, endIndex) assert(startIndex <= endIndex, "startIndex must be less than or equal to endIndex") local new = {} local index = 1 for i = 1, math.min(#list, startIndex - 1) do new[index] = list[i] index = ...
127
Roblox/cryo
Roblox-cryo-94044ed/src/List/removeValue.lua
luau
.lua
--[[ Creates a new list that has no occurrences of the given value. ]] local function removeValue(list, value) local new = {} local index = 1 for i = 1, #list do if list[i] ~= value then new[index] = list[i] index = index + 1 end end return new end return removeValue
85
Roblox/cryo
Roblox-cryo-94044ed/src/List/replaceIndex.lua
luau
.lua
--[[ Returns a new list with the new value replaced at the given index. ]] local function replaceIndex(list, index, value) local new = {} local len = #list assert(index <= len, "index must be less or equal than the list length") for i = 1, len do if i == index then new[i] = value else new[i] = list[i]...
102
Roblox/cryo
Roblox-cryo-94044ed/src/List/reverse.lua
luau
.lua
--[[ Returns a new list with the reversed order of the given list ]] local function reverse(list) local new = {} local len = #list local top = len + 1 for i = 1, len do new[i] = list[top - i] end return new end return reverse
68
Roblox/cryo
Roblox-cryo-94044ed/src/List/sort.lua
luau
.lua
--[[ Returns a new list, ordered with the given sort callback. If no callback is given, the default table.sort will be used. ]] local function sort(list, callback) local new = {} for i = 1, #list do new[i] = list[i] end table.sort(new, callback) return new end return sort
74
Roblox/cryo
Roblox-cryo-94044ed/src/None.lua
luau
.lua
--[[ Represents a value that is intentionally present, but should be interpreted as `nil`. Cryo.None is used by included utilities to make removing values more ergonomic. ]] local None = newproxy(true) getmetatable(None).__tostring = function() return "Cryo.None" end return None
67
Roblox/cryo
Roblox-cryo-94044ed/src/equalObjects.lua
luau
.lua
--!strict local function equalObjects(...) local firstObject = select(1, ...) for i = 2, select("#", ...) do if firstObject ~= select(i, ...) then return false end end return true end return equalObjects
60
Roblox/cryo
Roblox-cryo-94044ed/src/equalsDeep.lua
luau
.lua
--!strict local equalObjects = require(script.Parent.equalObjects) local function compareDeep(a, b) if type(a) ~= "table" or type(b) ~= "table" then return a == b end for key, value in a do if not compareDeep(b[key], value) then return false end end for key, value in b do if not compareDeep(a[key], v...
195
Roblox/cryo
Roblox-cryo-94044ed/src/init.lua
luau
.lua
return { Dictionary = require(script.Dictionary), List = require(script.List), isEmpty = require(script.isEmpty), None = require(script.None), }
28
Roblox/cryo
Roblox-cryo-94044ed/src/isEmpty.lua
luau
.lua
local function isEmpty(object) return next(object) == nil end return isEmpty
17
Roblox/cryo
Roblox-cryo-94044ed/tests/init.server.lua
luau
.lua
-- Lest chokes on .server.lua files so we pass the `spec` module to it and mount -- this file in our project so we can run tests in Studio. require(script.spec)
41
Roblox/cryo
Roblox-cryo-94044ed/tests/spec.lua
luau
.lua
local ReplicatedStorage = game:GetService("ReplicatedStorage") local TestEZ = require(ReplicatedStorage.Packages.Dev.TestEZ) local results = TestEZ.TestBootstrap:run({ ReplicatedStorage.Packages.Cryo, }) local success, ProcessService = pcall(game.GetService, game, "ProcessService") if success and ProcessService the...
96
ffrostfall/luausignal
ffrostfall-luausignal-52747df/.lute/tests.luau
luau
.luau
local task = require("@lute/task") task.spawn(function() require("@tests/signal.spec")() end)
23
ffrostfall/luausignal
ffrostfall-luausignal-52747df/benches/collect.bench.luau
luau
.luau
--!optimize 2 --!native local ReplicatedStorage = game:GetService("ReplicatedStorage") local signal = require(ReplicatedStorage.signal) return { Functions = { ["bit manip: construct collectors"] = function(Profiler: any) local sig = signal() Profiler.Begin("construct") for i = 1, 31 do sig:collect() ...
430
ffrostfall/luausignal
ffrostfall-luausignal-52747df/benches/libs/goodsignal.luau
luau
.luau
--!optimize 2 --!native -------------------------------------------------------------------------------- -- Batched Yield-Safe Signal Implementation -- -- This is a Signal class which has effectively identical behavior to a -- -- normal RBXScriptSignal, with the only difference b...
1,475
ffrostfall/luausignal
ffrostfall-luausignal-52747df/benches/signal.bench.luau
luau
.luau
--!optimize 2 --!native local ReplicatedStorage = game:GetService("ReplicatedStorage") local goodsignal = require(ReplicatedStorage.benches.libs.goodsignal) local luausignal = require(ReplicatedStorage.signal) return { Functions = { ["luausignal constructor"] = function() local _s for i = 1, 500 do _s =...
663
ffrostfall/luausignal
ffrostfall-luausignal-52747df/src/init.luau
luau
.luau
--!optimize 2 --!native local task = task or require("@lute/task") local tspawn = task.spawn local NIL_TABLE = {} local free_thread: thread? = nil local function bitmask(idx: number) return 2 ^ idx end local function set_bit(int: number, mask: number): number return bit32.bor(int, mask) end local function get_bi...
1,830
ffrostfall/luausignal
ffrostfall-luausignal-52747df/vendor/testkit.luau
luau
.luau
--!nocheck --!nolint ------------------------------------------------------------------------------- -- testkit.luau -- v0.7.3 -------------------------------------------------------------------------------- local color = { white_underline = function(s: string) return `\27[1;4m{s}\27[0m` end, white = function(s...
2,781
Roblox/luau-regexp
Roblox-luau-regexp-5672cbe/bin/parseTestFile.lua
luau
.lua
-- this limits the total number of regex tests that will be parsed -- from the pcre2 test file. local MAX = 100000 local function parseTestFile(file) local testCaseList = {} local start = file:find("^/") local count = 0 while start ~= nil do count = count + 1 local ending = file:find("/", start + 1) local...
572
Roblox/luau-regexp
Roblox-luau-regexp-5672cbe/bin/spec.lua
luau
.lua
local ProcessService = game:GetService("ProcessService") local Root = script.Parent.LuauRegExpTestModel local Packages = Root.Packages local TestEZ = require(Root.Packages.Dev.TestEZ) -- Run all tests, collect results, and report to stdout. local result = TestEZ.TestBootstrap:run( { Packages.RegExp }, TestEZ.Report...
119
Roblox/luau-regexp
Roblox-luau-regexp-5672cbe/src/RegEx/__tests__/escapeString.lua
luau
.lua
local ESCAPES = { ["\n"] = "n", ["\r"] = "r", ["\t"] = "t", ["\f"] = "f", ["\a"] = "a", ["\v"] = "v", ["\\"] = "\\", } local ESCAPE_CHARS = {} for char in pairs(ESCAPES) do table.insert(ESCAPE_CHARS, char) end local ESCAPE_CLASS = ("[%s%%c]"):format(table.concat(ESCAPE_CHARS, "")) local function escapeString(s...
165
Roblox/luau-regexp
Roblox-luau-regexp-5672cbe/src/Regexp.global.lua
luau
.lua
local RegEx = require(script.Parent.RegEx) type Array<T> = { [number]: T } type RegExpExecArray = Array<string> & { index: number?, input: string?, n: number } export type RegExp = { exec: (self: RegExp, input: string) -> RegExpExecArray | nil, test: (self: RegExp, input: string) -> boolean, } local RegExp =...
435