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
Scythe-Technology/luau-raylib
Scythe-Technology-luau-raylib-1aa4fbb/src/native/textures.luau
luau
.luau
--!strict --!optimize 2 --!native local ffi = zune.ffi; local raylib = require("./raylib"); local structs = raylib.structs; local void = ffi.types.void; local int = ffi.types.i32; local uint = ffi.types.u32; local bool = ffi.types.u8; local float = ffi.types.float; local cstring = ffi.types.pointer; type int = numb...
6,821
dphfox/autput
dphfox-autput-24076b7/examples/01-hello-autput/lune/build-this-example.luau
luau
.luau
--!nocheck --selene: allow(incorrect_standard_library_use) local build_single_example = require("../../build-examples/build_single_example") build_single_example("01-hello-autput", "bin")
43
dphfox/autput
dphfox-autput-24076b7/examples/01-hello-autput/src-luau/init.server.luau
luau
.luau
--!nocheck -- See src/main.rs for an introduction to this example. local autput = require(script.Parent.autput) local example_wasm_loader = require(script.Parent.target_luau.example_wasm) local wasm_env = { func_list = {} } local finish_autput_init = autput.init(wasm_env) local example_wasm_module = example_wasm_load...
100
dphfox/autput
dphfox-autput-24076b7/luau/autput.luau
luau
.luau
--!strict --Licensed under BSD3 from Autput, (c) Daniel P H Fox 2025 -------------------------------------------------------------------------------- -- TYPE DEFINITIONS ------------------------------------------------------------ -------------------------------------------------------------------------------- -- Typ...
1,101
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/bool.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for booleans local readu8 = buffer.readu8 local writeu8 = buffer.writeu8 --// Return Handler return table.freeze({ size = 1, default = false, requiredType = "boolean", read = @native function(buf: buffer, cursor: number) return readu8(buf, cursor) == 1 end, ...
128
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/float32.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for float32 local readf32 = buffer.readf32 local writef32 = buffer.writef32 --// Return Handler return table.freeze({ size = 4, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) return readf32(buf, cursor) end, write ...
118
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/float64.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for float64 local readf64 = buffer.readf64 local writef64 = buffer.writef64 --// Return Handler return table.freeze({ size = 8, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) return readf64(buf, cursor) end, write ...
118
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/int16.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for int16 local readi16 = buffer.readi16 local writei16 = buffer.writei16 --// Return Handler return table.freeze({ size = 2, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) return readi16(buf, cursor) end, write = ...
118
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/int32.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for int32 local readi32 = buffer.readi32 local writei32 = buffer.writei32 --// Return Handler return table.freeze({ size = 4, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) return readi32(buf, cursor) end, write = ...
118
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/int64.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for int64 local readi32 = buffer.readi32 local writei32 = buffer.writei32 --// Return Handler return table.freeze({ size = 8, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) local low = readi32(buf, cursor) if low < ...
317
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/int8.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for int8 local readi8 = buffer.readi8 local writei8 = buffer.writei8 --// Return Handler return table.freeze({ size = 1, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) return readi8(buf, cursor) end, write = @nativ...
118
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/string.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for string local writestring = buffer.writestring local readstring = buffer.readstring local readu16 = buffer.readu16 local writeu16 = buffer.writeu16 local len = string.len --// Return Handler return { size = 2, default = "", requiredType = "string", ref = nil,...
185
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/uint16.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for uint16 local readu16 = buffer.readu16 local writeu16 = buffer.writeu16 --// Return Handler return table.freeze({ size = 2, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) return readu16(buf, cursor) end, write =...
118
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/uint32.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for uint32 local readu32 = buffer.readu32 local writeu32 = buffer.writeu32 --// Return Handler return table.freeze({ size = 4, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) return readu32(buf, cursor) end, write =...
118
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/uint64.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for uint64 local readu32 = buffer.readu32 local writeu32 = buffer.writeu32 --// Return Handler return table.freeze({ size = 8, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) local low = readu32(buf, cursor) local hi...
196
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/DataTypes/uint8.luau
luau
.luau
-- Written by @TenebrisNoctua -- DataType module for uint8 local readu8 = buffer.readu8 local writeu8 = buffer.writeu8 --// Return Handler return table.freeze({ size = 1, default = 0, requiredType = "number", read = @native function(buf: buffer, cursor: number) return readu8(buf, cursor) end, write = @nati...
118
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/Proxy.luau
luau
.luau
--!native -- Written by @TenebrisNoctua -- Creates a proxy for the buffer object, so metamethods can be applied. --// Variables local Types = require('./Types') --// Types type anyTable = Types.anyTable --// Return Constructor return function(metatable: anyTable) --[[ -- To use it with userdata proxy, replace ...
168
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/Types.luau
luau
.luau
-- Written by @TenebrisNoctua -- Contains the types which will be used within the library. --// Essential Types export type anyTable = {[any]: any} export type dataType<T> = { read size: number, read default: any, read requiredType: string, read ref: any?, read write: (buf: buffer, cursor: number, value: any)...
198
TenebrisNoctua/StructU
TenebrisNoctua-StructU-75e2871/src/init.luau
luau
.luau
--!strict --!native -- Written by @TenebrisNoctua -- Contains the main StructU code. --// Variables local Types = require('@self/Types') local Proxy = require('@self/Proxy') local int8 = require('@self/DataTypes/int8') local int16 = require('@self/DataTypes/int16') local int32 = require('@self/DataTypes/int32') loc...
1,020
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/docsgen/init.luau
luau
.luau
--> Generate markdown documentation from moonwave comments local process = require("@lune/process") local serde = require("@lune/serde") local moonwave = require("@self/moonwave") local logger = require("@self/log") local writeMarkdown = require("@self/markdown") local function extract(input: string): (number, { moo...
226
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/docsgen/log.luau
luau
.luau
local stdio = require("@lune/stdio") local base = stdio.style("bold") local STYLE_INFO = base .. `{stdio.color("green")}info{stdio.color("reset")}:` local STYLE_WARN = base .. `{stdio.color("yellow")}warn{stdio.color("reset")}:` local STYLE_ERROR = base .. `{stdio.color("red")}error{stdio.color("reset")}:` export ty...
207
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/docsgen/markdown.luau
luau
.luau
local fs = require("@lune/fs") local moonwave = require("./moonwave") local logger = require("./log") local function writeSectionHeader(buf: string, title: string) buf ..= `### {title}\n` return buf end local function writeRef(buf: string, name: string, fragment: string?) buf ..= `\n[{name}]: #{fragment or name}\...
1,305
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/fmt.luau
luau
.luau
--> Run stylua to check for formatting errors local process = require("@lune/process") local CommandBuilder = require("./util/exec") process.exit(CommandBuilder.new("stylua"):withArgs(process.args):withArg("."):withStdioStrategy("forward"):exec().code)
57
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/tests/init.luau
luau
.luau
--> Run tests using frktest runner local fs = require("@lune/fs") local process = require("@lune/process") local frktest = require("../luau_packages/frktest") local reporter = require("@self/reporter") -- HACK: Cast require to allow for dynamic paths in strict mode -- A more proper solution would be to use luau.load...
626
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/typecheck.luau
luau
.luau
--> Run luau-lsp analysis to check for type errors local process = require("@lune/process") local CommandBuilder = require("./util/exec") process.exit( CommandBuilder.new("luau-lsp") :withArg("analyze") :withArgs({ "--settings", ".vscode/settings.json" }) :withArgs({ "--ignore", "'**/*_packages/**/*'" }) :w...
110
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/util/channel.luau
luau
.luau
--> util: An MPSC synchronization primitive powered by Lua upvalues which retains only --> one value at a time. --- ## Usage --- ```luau --- local send, recv = watch((nil :: any) :: string) --- task.delay(5, send, "hello, world!") --- task.spawn(function() --- local value = recv() --- print("received value:", ...
266
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/util/exec.luau
luau
.luau
--> lib: Builder pattern class to spawn child processes local process = require("@lune/process") local stdio = require("@lune/stdio") local CommandBuilder = {} export type CommandBuilder = typeof(setmetatable({} :: CommandBuilderFields, { __index = CommandBuilder })) type CommandBuilderFields = { program: string, ...
640
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/.lune/util/reader_utils.luau
luau
.luau
local process = require("@lune/process") local exports = {} export type ChildProcessReader = typeof(({} :: process.ChildProcess).stdout) local CHUNK_SIZE = 8 * 1024 -- 8 KB --- Luau implementation of `ChildReader:readToEnd`. --- --- This is a workaround for a lune bug which causes child processes to --- never exit. ...
476
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/examples/tour.luau
luau
.luau
local fs = require("@lune/fs") local zip = require("../lib") local asciitable = require("../luau_packages/asciitable") local file = fs.readFile("tests/data/files_and_dirs.zip") local reader = zip.load(buffer.fromstring(file)) --- Transforms a tree of recursive `{ [string]: EntryData }` to a recursive tree of --- `{ [...
738
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/lib/crc.luau
luau
.luau
local CRC32_TABLE: { number } = table.create(256) -- TODO: Maybe compute this AoT as an optimization -- Initialize the lookup table and lock it in place for i = 0, 255 do local crc = i for _ = 1, 8 do if bit32.band(crc, 1) == 1 then crc = bit32.bxor(bit32.rshift(crc, 1), 0xEDB88320) else crc = bit32.rshift...
738
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/lib/inflate.luau
luau
.luau
-- Tree class for storing Huffman trees used in DEFLATE decompression local Tree = {} export type Tree = typeof(setmetatable({} :: TreeInner, { __index = Tree })) type TreeInner = { table: { number }, -- Length of 16, stores code length counts trans: { number }, -- Length of 288, stores code to symbol translations ...
5,317
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/lib/utils/path.luau
luau
.luau
--- Canonicalize a path by removing redundant components local function canonicalize(path: string): string -- We convert any `\\` separators to `/` separators to ensure consistency local components = string.split(path:gsub("\\", "/"), "/") local result = {} for _, component in components do if component == "." th...
826
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/scripts/generate_inflate_testdata.luau
luau
.luau
local fs = require("@lune/fs") local zlib = require("./util/zlib") local toHex = require("./util/hex") local testCases = require("../tests/data/inflate/cases") local TEST_DATA_DIR = "tests/data/inflate" print("Generating inflate test files to", TEST_DATA_DIR) fs.writeDir(TEST_DATA_DIR) for _, case in testCases do l...
176
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/scripts/generate_invalid_version_zip.luau
luau
.luau
local fs = require("@lune/fs") local stdio = require("@lune/stdio") local process = require("@lune/process") -- stylua: ignore local function createZip(version: number): buffer version = version or math.random(63, 100) print("Using version:", version) local data = buffer.create(98) local pos = ...
1,136
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/scripts/util/adler32.luau
luau
.luau
local MOD_ADLER = 65521 local function adler32(buf: buffer): number local a = 1 local b = 0 for i = 0, buffer.len(buf) - 1 do local byte = buffer.readu8(buf, i) a = (a + byte) % MOD_ADLER b = (b + a) % MOD_ADLER end return bit32.lshift(b, 16) + a end return adler32
110
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/scripts/util/hex.luau
luau
.luau
local function toHex(data: string, maxBytes: number) local bytes = {} for i = 1, math.min(#data, maxBytes) do bytes[i] = string.format("%02X", data:byte(i)) end local hex = table.concat(bytes, " ") if #data > maxBytes then hex = hex .. string.format(" ... (%d bytes total)", #data) end return hex end retur...
97
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/scripts/util/zlib.luau
luau
.luau
local serde = require("@lune/serde") local adler32 = require("./adler32") export type Level = "Low" | "Fast" | "Default" | "Best" export type Compressed = { raw: buffer, level: Level, } local ZLIB_MAGIC_BYTE = 0x78 local COMPRESSION_LEVELS: { [number]: Level } = { [0x01] = "Low", [0x5E] = "Fast", [0x9C] = "Defau...
424
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/custom_decompression.luau
luau
.luau
local fs = require("@lune/fs") local serde = require("@lune/serde") local frktest = require("../luau_packages/frktest") local check = frktest.assert.check local unzip = require("../lib") type DecompressionRoutines = { [number]: unzip.DecompressionRoutine } return function(test: typeof(frktest.test)) test.suite("Cu...
673
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/data/inflate/cases.luau
luau
.luau
return { { name = "literal_single", data = "x" }, { name = "literal_multiple", data = "Hello World!" }, { name = "repeated_a", data = string.rep("a", 100) }, { name = "repeated_ab", data = string.rep("ab", 50) }, { name = "repeated_long", data = string.rep("x", 2324) }, { name = "mixed", data = "abc" .. string.re...
164
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/edge_cases.luau
luau
.luau
local fs = require("@lune/fs") local process = require("@lune/process") local serde = require("@lune/serde") local frktest = require("../luau_packages/frktest") local check = frktest.assert.check local reader = require("../.lune/util/reader_utils") local ZipReader = require("../lib") return function(test: typeof(frk...
934
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/extract.luau
luau
.luau
local fs = require("@lune/fs") local process = require("@lune/process") local frktest = require("../luau_packages/frktest") local check = frktest.assert.check local readToEnd = require("../.lune/util/reader_utils").readToEnd local ZipReader = require("../lib") -- Reuse the same ZIP files from metadata tests local ZI...
671
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/inflate.luau
luau
.luau
local fs = require("@lune/fs") local frktest = require("../luau_packages/frktest") local check = frktest.assert.check local inflate = require("../lib/inflate") local TEST_CASES = require("./data/inflate/cases") return function(test: typeof(frktest.test)) test.suite("Inflate decompression tests", function() for _...
345
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/list.luau
luau
.luau
local fs = require("@lune/fs") local process = require("@lune/process") local frktest = require("../luau_packages/frktest") local check = frktest.assert.check local ZipReader = require("../lib") return function(test: typeof(frktest.test)) test.suite("ZIP listing tests (top-level)", function() test.case("Lists all...
571
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/metadata.luau
luau
.luau
local fs = require("@lune/fs") local process = require("@lune/process") local DateTime = require("@lune/datetime") local frktest = require("../luau_packages/frktest") local check = frktest.assert.check local readToEnd = require("../.lune/util/reader_utils").readToEnd local unzip = require("../lib") local ZIPS = fs.r...
1,765
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/path.luau
luau
.luau
local frktest = require("../luau_packages/frktest") local check = frktest.assert.check local path = require("../lib/utils/path") return function(test: typeof(frktest.test)) test.suite("Path utilities function as expected", function() test.case("Canonicalize should handle basic paths", function() check.equal(pat...
731
0x5eal/luau-unzip
0x5eal-luau-unzip-5ed3cf9/tests/walk.luau
luau
.luau
local fs = require("@lune/fs") local process = require("@lune/process") local frktest = require("../luau_packages/frktest") local check = frktest.assert.check local ZipReader = require("../lib") local ZIPS = { "tests/data/files_and_dirs.zip", "tests/data/symlink.zip", "tests/data/extended_timestamp.zip", } retur...
596
CompeyDev/rusty-luau
CompeyDev-rusty-luau-648c534/.lune/lint.luau
luau
.luau
--> Run selene for linting local process = require("@lune/process") local CommandBuilder = require("./util/exec") process.exit(CommandBuilder.new("selene"):withArg("."):withStdioStrategy("forward"):exec().code)
50
CompeyDev/rusty-luau
CompeyDev-rusty-luau-648c534/.lune/typecheck.luau
luau
.luau
--> Run luau-lsp analysis to check for type errors local process = require("@lune/process") local CommandBuilder = require("./util/exec") process.exit( CommandBuilder.new("luau-lsp") :withArg("analyze") :withArgs({ "--platform", "standard" }) :withArgs({ "--settings", ".vscode/settings.json" }) :withArgs(...
122
CompeyDev/rusty-luau
CompeyDev-rusty-luau-648c534/examples/russianRoullete.luau
luau
.luau
local result = require("../lib/result") type Result<T, E> = result.Result<T, E> local Ok = result.Ok local Err = result.Err local function canError(): Result<number, string> if math.round(math.random()) == 1 then return Err("you DIED") end return Ok(69) end function main() local val = canError():unwrap() pri...
95
CompeyDev/rusty-luau
CompeyDev-rusty-luau-648c534/lib/conversion.luau
luau
.luau
--[[ This exists because if the Option module were to have methods to convert to Result, and the Result module were to have methods to convert to Option, there would be a cyclic dependency. So, if a consumer of this library wants to convert between the two, they would rather import this conversion module. ]] loc...
1,507
CompeyDev/rusty-luau
CompeyDev-rusty-luau-648c534/lib/match.luau
luau
.luau
--[=[ @class Match A match expression branches on a pattern. Match expressions must be exhaustive, meaning that every possible pattern must be matched, i.e., have an arm handling it. The catch all arm (`_`), which matches any value, can be used to do this. Match expressions also ensure that all of the left...
833
CompeyDev/rusty-luau
CompeyDev-rusty-luau-648c534/lib/option.luau
luau
.luau
local tableEq = require("./util").tableEq --[=[ @class Option Type [Option] represents an optional value: every [Option] is either [Option:Some] and contains a value, or [Option:None], and does not. Common uses of an [Option] may involve: * Initial values * Return values for functions that are not defined ove...
5,857
CompeyDev/rusty-luau
CompeyDev-rusty-luau-648c534/lib/result.luau
luau
.luau
local tableEq = require("./util").tableEq --[=[ @class Result Error handling with the [Result] type. [Result]`<T, E>` is the type used for returning a possible error. It is a class with the constructor variants, [Result:Ok]`(T)`, representing success and containing a value, and [Result:Err]`(E)`, representing...
6,030
Roblox/symbol-luau
Roblox-symbol-luau-83d7311/scripts/run-tests.lua
luau
.lua
local Root = script.Parent["SymbolTest"] local processServiceExists, ProcessService = pcall(function() return game:GetService("ProcessService") end) local Packages = Root.Packages if not Packages or not Packages:FindFirstChild("Dev") then game:GetService("TestService"):Error("Invalid Package configuration. Try runni...
200
Roblox/symbol-luau
Roblox-symbol-luau-83d7311/src/Registry.global.lua
luau
.lua
local Symbol = require(script.Parent.Symbol) local GlobalRegistry: { [string]: Symbol.Symbol } = {} return { getOrInit = function(name: string): Symbol.Symbol if GlobalRegistry[name] == nil then GlobalRegistry[name] = Symbol.new(name) end return GlobalRegistry[name] end, -- Used for testing __clear = fu...
86
Roblox/symbol-luau
Roblox-symbol-luau-83d7311/src/init.lua
luau
.lua
--!strict --[[ A 'Symbol' is an opaque marker type, implemented to behave similarly to JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol ]] local Symbol = require(script.Symbol) export type Symbol = Symbol.Symbol local GlobalRegistry = require(script["Registry.global"]) loca...
152
Roblox/symbol-luau
Roblox-symbol-luau-83d7311/src/jest.config.lua
luau
.lua
return { displayName = "Symbol", testMatch = { "**/__tests__/**/*.spec" }, }
21
folly-org/folly
folly-org-folly-46a5fc3/editor/core/config.luau
luau
.luau
local loaded_config = { user = { cursor = { -- BLOCK, LINE style = "LINE" }, tab_spacing = 4, }, } -- replace loaded_config with the file read from disk, -- if not found, create new file with the config above local config = {} local metatable = { __index = function (t,k) return loa...
122
folly-org/folly
folly-org-folly-46a5fc3/editor/core/init.luau
luau
.luau
local util = require("util/main") local kc = require("util/keycodes") local config = require("config") local font = Renderer.Font.load("./resources/JetBrainsMono-Regular.ttf") local font2 = Renderer.Font.load("./resources/Raveo-Regular.otf") local buf = File.read("./editor/core/init.luau"):gsub("\r", "") local font_...
1,446
folly-org/folly
folly-org-folly-46a5fc3/editor/core/main.luau
luau
.luau
return function() print("this is core/main!") end
13
folly-org/folly
folly-org-folly-46a5fc3/editor/core/util/keycodes.luau
luau
.luau
return { null = 0, apostrophe = 39, comma = 44, minus = 45, period = 46, slash = 47, zero = 48, one = 49, two = 50, three = 51, four = 52, five = 53, six = 54, seven = 55, eight = 56, nine = 57, semicolon = 59, equal = 61, a = 65, b = 66, ...
732
folly-org/folly
folly-org-folly-46a5fc3/editor/core/util/main.luau
luau
.luau
local t = {} function t:MakeColor(r: number, g: number, b: number, a: number) return { red = r, green = g, blue = b, alpha = a } end return t
54
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/examples/basic/luau-lint.config.luau
luau
.luau
--!strict --[=[ Basic luau-lint configuration example This shows a minimal configuration for a typical Luau project. ]=] return { -- Enable recommended rules plugin plugins = { "@luau-lint/recommended-rules", }, -- Configure individual rules rules = { ["generalized-iteration"] = "error", }, -- This...
96
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/examples/concept.luau
luau
.luau
-- Final Proof-of-Concept Demonstration -- Luau Hybrid Linter: Complete Functionality Test local luau = require("@lute/luau") local parser = require("@batteries/syntax/parser") local visitor = require("@batteries/syntax/visitor") print("🎯 LUAU HYBRID LINTER - FINAL DEMONSTRATION") print("=" .. string.rep("=", 60)) pr...
1,246
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/examples/example-rule.luau
luau
.luau
--[[ Example Rule: Generalized Iteration This example demonstrates a single rule implementation following the proposed Rule API for the Luau Linter. This showcases how rules are structured and how they interact with the AST visitor system. The rule detects usage of pairs() and ipairs() in ...
1,450
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/cli/src/args.luau
luau
.luau
-- src/cli/args.luau -- Placeholder for command-line argument parsing logic -- Will be implemented to support --help, --version, --config, --fix flags -- and file/directory path handling. -- TODO: Replace with actual Lute process API usage for argument access export type ParsedArgs = { help: boolean, version: boole...
487
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/cli/src/init.luau
luau
.luau
--!strict --[=[ @class LuauLintCLI Command-line interface for luau-lint This module provides the main entry point for the luau-lint CLI package. @since v0.1.0 ]=] local Args = require("@self/args") local Main = require("@self/main") local Output = require("@self/output") return { Args = Args, Main = Main, ...
91
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/cli/src/main.luau
luau
.luau
-- src/cli/main.luau -- Main command-line interface entry point for Luau Linter. local Args = require("./args") local Fs = require("@lute/fs") local Luau = require("@lute/luau") local OutputFormatter = require("./output") local Parser = require("@batteries/syntax/parser") local PluginApi = require("@luau-lint/plugin-a...
1,798
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/cli/src/output.luau
luau
.luau
-- src/cli/output.luau -- Handles formatting of linting results. local PluginApi = require("plugin_api") local json = require("@batteries/json") type LintResult = PluginApi.LintResult export type FormatterOptions = { showSourceContext: boolean?, -- For text formatter } local function formatAsText(results: { LintRe...
932
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/config/src/init.luau
luau
.luau
--!strict --[=[ @class LuauLintConfig Configuration system for luau-lint This module handles loading, validating, and managing luau-lint configuration. @since v0.1.0 ]=] export type LuauLintConfig = { plugins: { string }?, rules: { [string]: "error" | "warn" | "off" }?, extends: { string }?, root: boolean?...
229
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/core/src/context/context.luau
luau
.luau
--!strict local ApiTypes = require("../api-types/api") local types = require("../types") type Pick<K, V> = types.Pick<K, V> --[=[ @class RuleContext RuleContext Implementation for luau-lint Plugin API This module implements the RuleContext interface that provides utilities for rules to report issues, create fi...
1,392
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/core/src/engine/engine.luau
luau
.luau
--!strict --[=[ @class RuleEngine Rule Execution Engine for luau-lint Plugin API This module implements the rule execution engine that orchestrates the linting process. It performs single-pass AST traversal, calls relevant rule listeners for each node type, handles errors gracefully, and collects all issues fo...
4,288
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/core/src/init.luau
luau
.luau
--!strict --[=[ @class LuauLintCore Core linting engine for luau-lint This module provides the main entry point for the luau-lint core package. It exports the essential components needed for linting Luau code. @since v0.1.0 ]=] local ApiTypes = require("@self/api-types/api") local Engine = require("@self/engi...
294
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/core/src/pretty-print.luau
luau
.luau
type ExistingOptions = { rawStrings: boolean?, depth: number?, keys: { string }?, shouldPrint: boolean?, } local isPrimitiveType = { string = true, number = true, boolean = true } local typeSortOrder: { [string]: number } = { ["boolean"] = 1, ["number"] = 2, ["string"] = 3, ["function"] = 4, ["vector"] = 5, ...
1,560
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/core/src/registry/registry.luau
luau
.luau
--!strict --[=[ @class RuleRegistry Rule Registration System for luau-lint Plugin API This module implements the rule registration system that manages rule definitions, validates rule metadata, and provides efficient batching of rules by their node type interests. This enables the engine to handle 200+ rules ef...
2,792
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/core/src/rule/rule.luau
luau
.luau
--!strict --[=[ @class Rule Rule Implementation for luau-lint Plugin API This module provides validation functions for rule definitions and listener maps. It works with the types defined in the core types/api module. @since v0.1.0 ]=] local ApiTypes = require("../api-types/api") -- Import types from the API m...
1,541
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/core/src/traversal/visitor-keys.luau
luau
.luau
local VisitorKeys: { [string]: { string } } = { -- AstExprGroup ["group"] = { "openParens", "expression", "closeParens", }, -- AstExprConstantNil ["nil"] = { -- Token fields inherited }, -- AstExprConstantBool ["boolean"] = { "value", -- Token fields inherited }, -- AstExprConstantNumber ["num...
2,015
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/plugin-api/src/init.luau
luau
.luau
--!strict --[=[ @class LuauLintPluginAPI Public API for luau-lint plugin authors This module provides the complete API surface that plugin authors need to create custom rules for luau-lint. @since v0.1.0 ]=] local PluginAPI = require("@self/plugin-api") return { PluginAPI = PluginAPI, }
78
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/plugin-api/src/plugin-api.luau
luau
.luau
--!strict --[=[ @class PluginAPI Main Plugin API for luau-lint This module provides the primary API for the luau-lint plugin system, implementing the listener pattern architecture. It offers a clean, intuitive developer experience for creating custom linting rules with comprehensive validation, e...
1,279
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/test-utils/src/init.luau
luau
.luau
--!strict --[=[ @class LuauLintTestUtils Shared testing utilities for luau-lint packages This module provides common testing utilities, fixtures, and the "tiniest" testing framework for all luau-lint packages. @since v0.1.0 ]=] local TestFixtures = require("@self/test-fixtures") local Tiniest = require("@self...
147
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest.luau
luau
.luau
-- From dphfox/tiniest, licenced under BSD --!strict local tiniest_plugin = require("./tiniest_plugin") type Context = DescribeContext | RunContext type DescribeContext = { type: "describe", labels: { string }, add_test: (Test) -> (), } type RunContext = { type: "run", } export type ErrorReport = { type: "tin...
1,332
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest_expect.luau
luau
.luau
-- From dphfox/tiniest, licenced under BSD --!strict local tiniest_quote = require("./tiniest_quote") local types = require("./types") local tiniest_expect = {} type Context = { target: unknown, test: string, params: { unknown }, } local context: Context = { target = nil, test = "", params = {}, } local func...
1,125
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest_for_lute.luau
luau
.luau
-- From dphfox/tiniest, licensed under BSD3 --!strict local fs = require("@lute/fs") local luau = require("@lute/luau") local tiniest = require("./tiniest") local tiniest_expect = require("./tiniest_expect") local tiniest_pretty = require("./tiniest_pretty") local tiniest_snapshot = require("./tiniest_snapshot") loca...
836
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest_pretty.luau
luau
.luau
-- From dphfox/tiniest, licenced under BSD --!strict local tiniest = require("./tiniest") local tiniest_plugin = require("./tiniest_plugin") type Test = tiniest.Test type TestRunResult = tiniest.TestRunResult type RunResult = tiniest.RunResult export type Options = { plugins: nil | { tiniest_plugin.Plugin }, disabl...
1,773
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest_snapshot.luau
luau
.luau
-- From dphfox/tiniest, licensed under BSD3 --!strict local tiniest = require("./tiniest") local tiniest_quote = require("./tiniest_quote") type Test = tiniest.Test export type TestRunResult = tiniest.TestRunResult & { num_snapshots_updated: number, num_snapshots_obsolete: number, } export type RunResult = tiniest....
1,240
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/types.luau
luau
.luau
--!strict --[[ Type definitions for the tiniest testing framework Based on dphfox/tiniest, licensed under BSD This file provides comprehensive type definitions for all tiniest framework functions to improve type safety in test files. ]] -- Core tiniest framework types export type Test = { labels: { ...
873
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/plugins/recommended/src/init.luau
luau
.luau
--!strict --[=[ @class RecommendedRules Default recommended rules for luau-lint This plugin contains the core set of rules that are recommended for most Luau projects. These rules enforce best practices and help catch common issues. @since v0.1.0 ]=] local GeneralizedIteration = require("./rules/generaliz...
134
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/run-tests.luau
luau
.luau
#!/usr/bin/env lute --!strict -- Simple test runner script local tiniest_module = require("./packages/test-utils/src/tiniest/tiniest_for_lute") local fs = require("@lute/fs") -- Configure tiniest local tiniest = tiniest_module.configure({ snapshot_path = "./tests/__snapshots__", save_snapshots = true, }) -- List o...
563
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/scripts/clean-directories.luau
luau
.luau
#!/usr/bin/env lune --[[ Clean Directories Script for luau-lint This script recursively removes all directories with specified names throughout the project. Useful for cleaning up generated files like luau_packages, node_modules, .pesde, etc. Usage: lune run scripts/clean-directories.luau...
2,132
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/scripts/copy-license.luau
luau
.luau
#!/usr/bin/env lune --[[ Copy License Script for luau-lint This script copies the root LICENSE file to each package directory in the packages/ folder to ensure all publishable packages have the proper licensing information. Usage: lune run scripts/copy-license.luau ]] local fs = require("@lune/f...
781
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/tests/__snapshots__/some_cool_features.snapshots.snap.luau
luau
.luau
-- Auto-generated by dphfox/tiniest. Do not modify! --!nocheck return {[====[{ ["bar"] = 2; ["foo"] = true; ["hello"] = "world"; }]====]}
51
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/tests/fixtures/.luau-lint.luau
luau
.luau
-- Example .luau-lint.luau configuration file for testing return { rules = { ["unused-variable"] = "warn", ["undefined-global"] = "error", }, ignorePatterns = { "*.generated.luau" }, severity = "warn", }
60
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/tests/fixtures/bad_code.luau
luau
.luau
-- Modern Luau code using generalized iteration local array = { 1, 2, 3, 4, 5 } -- Modern Luau: Direct iteration over values (no ipairs needed) for i, value in ipairs(array) do print(value) end -- -- Modern Luau: Still direct iteration (no ipairs needed) for index, item in ipairs(array) do print("Processing:", item...
303
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/tests/fixtures/before_after_example.luau
luau
.luau
-- Before and After: Luau Generalized Iteration Examples -- ❌ BEFORE: Legacy approach with ipairs/pairs --[[ local items = {"apple", "banana", "cherry"} -- Old way - unnecessary ipairs wrapper for i, item in ipairs(items) do print(i, item) end -- Old way - unnecessary pairs wrapper local settings = {theme = "d...
485
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/tests/fixtures/good_code.luau
luau
.luau
-- Modern Luau code demonstrating efficient iteration patterns local array = { 1, 2, 3, 4, 5 } -- When you need numeric indices specifically, use numeric for loop for i = 1, #array do print("Index:", i, "Value:", array[i]) end -- Modern Luau: Direct iteration over key-value pairs (replaces ipairs) for i, value in ar...
294
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/tests/fixtures/modern_code.luau
luau
.luau
-- Test file with modern Luau iteration that should pass linting local data = { 10, 20, 30, 40, 50 } -- Modern Luau: No ipairs needed for i, value in data do print("Item", i, ":", value) end -- Modern Luau: Dictionary iteration without pairs local config = { debug = true, timeout = 5000 } for key, val in config do ...
142
christopher-buss/luau-lint
christopher-buss-luau-lint-a56b501/tests/integration/old-test-runner.luau
luau
.luau
--!strict local fs = require("@lute/fs") local tiniest = require("@tiniest/tiniest_for_lute").configure({ snapshot_path = "./tests/__snapshots__", save_snapshots = true, }) -- Function to recursively find all .spec.luau files local function findTestFiles(directory: string): { string } local testFiles = {} local ...
639
vantoanvh/LuauPorts
vantoanvh-LuauPorts-15cd630/Compression/Zlib.luau
luau
.luau
--!optimize 2 --!native --!strict --[[ Deflate.luau Public API: - Deflate(Input: buffer, Level: number?) returns a raw RFC1951 DEFLATE stream. - Inflate(Input: buffer) accepts a raw RFC1951 DEFLATE stream and returns the decompressed buffer. - Compress(Input: buffer, Level: number?) returns an RFC1950 zlib strea...
13,570
vantoanvh/LuauPorts
vantoanvh-LuauPorts-15cd630/Compression/rANS.luau
luau
.luau
--!optimize 2 --!native local PROB_BITS = 12 local PROB_SCALE = 4096 local function compress(src: buffer): buffer local n = buffer.len(src) if n == 0 then return buffer.create(4) end local freqs = table.create(256, 0) for i = 0, n - 1 do local s = buffer.readu8(src, i) + 1 freqs[s] += 1 end local n...
1,346
vantoanvh/LuauPorts
vantoanvh-LuauPorts-15cd630/Conversion/Base85.luau
luau
.luau
--!optimize 2 --!native --!strict local POW1, POW2, POW3, POW4 = 85, 7225, 614125, 52200625 local ENC_LUT_HI = buffer.create(14000) local ENC_LUT_LO = buffer.create(30000) local DECODE_A = buffer.create(262144) local DECODE_B = buffer.create(262144) for i = 0, 6995 do buffer.writeu16(ENC_LUT_HI, i * 2, (i // 85 +...
2,348