repo
stringclasses
302 values
file_path
stringlengths
18
241
language
stringclasses
2 values
file_type
stringclasses
4 values
code
stringlengths
76
697k
tokens
int64
10
271k
itsfrank/frktest
itsfrank-frktest-aa72048/src/entrypoint.luau
luau
.luau
-- i'm not a fan of having a single entrypoint, but this seems to be idiomatic for pesde/wally -- with this, reporters will be acessible to folks who want to consume the lib through a single entrypoint local frktest = require("./frktest") local console_reporter = require("./reporters/console_reporter") type ConsoleRep...
222
itsfrank/frktest
itsfrank-frktest-aa72048/src/frktest.luau
luau
.luau
local frktest = {} local test = require("./test") local assert = require("./assert") -- make sure to initalize a reporter before running, otherwise you will get no output -- see `src/reporters` for builtin reporters available -- returns false if any test failed, true otherwise frktest.run = function(): boolean te...
104
itsfrank/frktest
itsfrank-frktest-aa72048/src/reporters/console_reporter.luau
luau
.luau
-- usage: -- local reporter = require("@frktest/reporters/console_reporter") -- reporter.init() -- -- run tests local types = require("../types") local utils = require("../utils") local inspect = require("../lib/inspect") local color = require("./runtimes/color") type Failure = types.Failure type DiffEntr...
1,611
itsfrank/frktest
itsfrank-frktest-aa72048/src/reporters/lune_console_reporter.luau
luau
.luau
-- file is kept here for backwards compatibility warn("[DEPRECATED] lune_console_reporter is deprecated, use console_reporter instead\n") return require("./console_reporter")
36
itsfrank/frktest
itsfrank-frktest-aa72048/src/reporters/runtimes/color.luau
luau
.luau
local runtime = require("./get_runtime")() type Color = "red" | "green" | "yellow" | "purple" type ColorFn = (Color, string) -> string -- default, fallback to plain print local color: ColorFn = function(_, s: string) return s end if runtime == "lune" then local stdio = require("@lune/stdio") color = func...
304
itsfrank/frktest
itsfrank-frktest-aa72048/src/reporters/runtimes/get_runtime.luau
luau
.luau
export type Runtime = "lune" | "zune" | "lute" | "unknown" return function(): Runtime if type(_VERSION) == "string" and string.sub(_VERSION, 1, 4) == "Lune" then return "lune" elseif type(_VERSION) == "string" and string.sub(_VERSION, 1, 4) == "Zune" then return "zune" else -- test ...
165
itsfrank/frktest
itsfrank-frktest-aa72048/src/test.luau
luau
.luau
local types = require("./types") local utils = require("./utils") local test = {} type Test = types.Test type Suite = types.Suite type ExecCounts = types.ExecCounts type ExecResult = types.ExecResult type TestError = types.TestError local _state = {} _state.suites = {} :: { Suite } _state.global_suite = {} :: { Test...
1,836
itsfrank/frktest
itsfrank-frktest-aa72048/src/types.luau
luau
.luau
type Location = { file: string, line: string, } export type Failure = { location: Location, message: string, user_msg: string?, complex_info: { type: string, data: any, }?, } export type DiffEntry<T> = { k: any, t: "+" | "-" | "~", v: T | { a: T, b: T }, -- latt...
265
itsfrank/frktest
itsfrank-frktest-aa72048/src/utils.luau
luau
.luau
local utils = {} function utils.trim(s: string): string return (s:gsub("^%s*(.-)%s*$", "%1")) end function utils.make_indent(i: number): string local spaces = " " local s = "" for j = 0, i - 1 do s = s .. spaces end return s end function utils.multiline_to_array(s: string): { strin...
209
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/.lune/exec.luau
luau
.luau
--> lib: Builder pattern class to spawn child processes local stdio = require("@lune/stdio") local process = require("@lune/process") local Option = require("../luau_packages/option") type Option<T> = Option.Option<T> local CommandBuilder = {} export type CommandBuilder = typeof(setmetatable({} :: Command...
736
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/.lune/fmt.luau
luau
.luau
--> Run stylua to check for formatting errors local process = require("@lune/process") local CommandBuilder = require("./exec") process.exit(CommandBuilder.new("stylua"):withArg("."):withArgs(process.args):withStdioStrategy("forward"):exec().code)
56
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/.lune/test.luau
luau
.luau
--> Run tests using frktest runner local fs = require("@lune/fs") local process = require("@lune/process") local frktest = require("@pkg/frktest") local reporter = require("../tests/_reporter") -- HACK: Cast require to allow for dynamic paths in strict mode -- A more proper solution would be to use luau.load instead...
455
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/.lune/typecheck.luau
luau
.luau
--> Run luau-lsp analysis to check for type errors local process = require("@lune/process") local CommandBuilder = require("./exec") process.exit( CommandBuilder.new("luau-lsp") :withArg("analyze") :withArgs({ "--settings", ".vscode/settings.json" }) :withArgs({ "--ignore", "'**/.pesde/**'" }) :w...
108
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/lib/init.luau
luau
.luau
local Option = require("../luau_packages/option") type Option<T> = Option.Option<T> local Result = require("../luau_packages/result") type Result<T, E> = Result.Result<T, E> local function stringStartsWith(str: string, sub: string) return string.sub(str, 1, #sub) == sub end local function hasLeadingZeros(num: strin...
3,623
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/tests/cmp.luau
luau
.luau
local frktest = require("@pkg/frktest") local check = frktest.assert.check local Option = require("../luau_packages/option") type Option<T> = Option.Option<T> local Semver = require("../lib") return function(test: typeof(frktest.test)) test.suite("Semver comparison tests", function() test.case("Basic version comp...
1,114
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/tests/parse_invalid.luau
luau
.luau
local frktest = require("@pkg/frktest") local check = frktest.assert.check local Semver = require("../lib") return function(test: typeof(frktest.test)) test.suite("Invalid semver parsing tests", function() test.case("Rejects missing components", function() local res = Semver.parse("1.2") check.is_true(res:is...
1,007
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/tests/parse_valid.luau
luau
.luau
local frktest = require("@pkg/frktest") local check = frktest.assert.check local Option = require("../luau_packages/option") type Option<T> = Option.Option<T> local Semver = require("../lib") return function(test: typeof(frktest.test)) test.suite("Basic tests", function() test.case("Semver creates valid version o...
491
0x5eal/semver-luau
0x5eal-semver-luau-3f77d74/tests/tostring.luau
luau
.luau
local frktest = require("@pkg/frktest") local check = frktest.assert.check local Option = require("../luau_packages/option") type Option<T> = Option.Option<T> local Semver = require("../lib") return function(test: typeof(frktest.test)) test.suite("Stringification tests", function() test.case("A version constructe...
721
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/constants/boolean_constant.luau
luau
.luau
local luau_spec = require("../../luau/spec") local boolean_constant = {} boolean_constant.__constant_type = luau_spec.LuauBytecodeConstants.LBC_CONSTANT_BOOLEAN boolean_constant.__index = boolean_constant function boolean_constant.new(value: boolean) return setmetatable({ value = value }, boolean_constant) end f...
97
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/constants/closure_constant.luau
luau
.luau
local luau_spec = require("../../luau/spec") local closure_constant = {} closure_constant.__constant_type = luau_spec.LuauBytecodeConstants.LBC_CONSTANT_CLOSURE closure_constant.__index = closure_constant function closure_constant.new(value: number) return setmetatable({ value = value }, closure_constant) end fu...
103
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/constants/import_constant.luau
luau
.luau
local luau_spec = require("../../luau/spec") local string_constant_class = require("string_constant") local import_constant = {} import_constant.__constant_type = luau_spec.LuauBytecodeConstants.LBC_CONSTANT_IMPORT import_constant.__index = import_constant function import_constant.new(value: { string_constant_class.C...
144
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/constants/nil_constant.luau
luau
.luau
local luau_spec = require("../../luau/spec") local nil_constant = {} nil_constant.__constant_type = luau_spec.LuauBytecodeConstants.LBC_CONSTANT_NIL nil_constant.__index = nil_constant function nil_constant.new() return setmetatable({}, nil_constant) end function nil_constant:__tostring() return "nil" end e...
87
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/constants/number_constant.luau
luau
.luau
local luau_spec = require("../../luau/spec") local number_constant = {} number_constant.__constant_type = luau_spec.LuauBytecodeConstants.LBC_CONSTANT_NUMBER number_constant.__index = number_constant function number_constant.new(value: number) return setmetatable({ value = value }, number_constant) end function ...
97
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/constants/string_constant.luau
luau
.luau
local luau_spec = require("../../luau/spec") local string_constant = {} string_constant.__constant_type = luau_spec.LuauBytecodeConstants.LBC_CONSTANT_STRING string_constant.__index = string_constant function string_constant.new(value: string) return setmetatable({ value = value }, string_constant) end function ...
99
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/constants/table_constant.luau
luau
.luau
local luau_spec = require("../../luau/spec") local table_constant = {} table_constant.__constant_type = luau_spec.LuauBytecodeConstants.LBC_CONSTANT_TABLE table_constant.__index = table_constant function table_constant.new(value: { any }) return setmetatable({ value = value }, table_constant) end function table_...
107
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/constants/vector_constant.luau
luau
.luau
local luau_spec = require("../../luau/spec") local vector_constant = {} vector_constant.__constant_type = luau_spec.LuauBytecodeConstants.LBC_CONSTANT_VECTOR vector_constant.__index = vector_constant function vector_constant.new(x: number, y: number, z: number, w: number) return setmetatable({ x= x, y = y, z = z,...
136
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/debug_info.luau
luau
.luau
export type DebugLocal = { name: string, -- var_int (string_table) start_pc: number, -- var_int end_pc: number, -- var_int, reg: number, -- byte } export type DebugUpval = { name: string, -- var_int (string_table) } export type DebugLocalsTable = { debug_locals_size: number, deb...
456
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/instruction.luau
luau
.luau
export type Registers = { A: number, B: number, C: number, D: number, E: number, } local luau_spec = require("../luau/spec") local binary_reader_class = require("../utilities/binary_reader") local instruction = {} instruction.__index = instruction local function arshift(x: number, disp: number): ...
373
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/line_info.luau
luau
.luau
local binary_reader_class = require("../utilities/binary_reader") local instruction_class = require("../classes/instruction") export type FunctionInstructionsTable = { instructions_size: number, instructions: { instruction_class.Class } } local line_info = {} line_info.__index = line_info function line_info....
375
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/string_table.luau
luau
.luau
local binary_reader_class = require("../utilities/binary_reader") local string_table = {} string_table.__index = string_table function string_table.new(binary_reader: binary_reader_class.Class) local self = setmetatable({}, string_table) self.string_count = binary_reader:read_var_int() self.strings = tab...
119
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/classes/version.luau
luau
.luau
local binary_reader_class = require("../utilities/binary_reader") local luau_spec = require("../luau/spec") local version = {} version.__index = version function version.new(binary_reader: binary_reader_class.Class) local self = setmetatable({}, version) self.bytecode_version = binary_reader:read_u8() if...
303
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/init.luau
luau
.luau
export type UserdataType = { index: number, name_ref: number, } local binary_reader_class = require("utilities/binary_reader") local version_class = require("classes/version") local string_table_class = require("classes/string_table") local func_class = require("classes/func") local deserializer = {} deserial...
411
Lovreware/Platinum
Lovreware-Platinum-7f415b3/deserializer/luau/spec.luau
luau
.luau
local LuauOpcode = { -- NOP: noop LOP_NOP = { index = 0, name = "NOP", has_aux = false }, -- BREAK: debugger break LOP_BREAK = { index = 1, name = "BREAK", has_aux = false }, -- LOADNIL: sets register to nil -- A: target register LOP_LOADNIL = { index = 2, name = "LOADNIL", has_aux = false...
5,779
Nicell/htmluau
Nicell-htmluau-eca3bd0/examples/cards.luau
luau
.luau
local net = require("@lute/net") local htmluau = require("../src") local html = htmluau.html local div = htmluau.div local head = htmluau.head local title = htmluau.title local body = htmluau.body local img = htmluau.img local h2 = htmluau.h2 local p = htmluau.p local createComponent = htmluau.createComponent local...
348
Nicell/htmluau
Nicell-htmluau-eca3bd0/examples/html.luau
luau
.luau
local net = require("@lute/net") local htmluau = require("../src") local html = htmluau.html local head = htmluau.head local title = htmluau.title local body = htmluau.body local h1 = htmluau.h1 local button = htmluau.button local p = htmluau.p local website = html({ lang = "en" }) { head() { title() { "Hello ...
210
Nicell/htmluau
Nicell-htmluau-eca3bd0/src/init.luau
luau
.luau
export type Node = string | () -> string -- Nodes are what user defined functions return type Element = () -> string -- Elements are what Components return type ChildlessElement = () -> Element -- ChildlessElements are when a component is called without children type Child = string | Element | ChildlessElement type Com...
1,405
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/examples/local-storage.luau
luau
.luau
local chrome = require("../src") local browser = chrome.browser.create() local tab = browser:create_tab() tab:navigate_to("https://www.wikipedia.org"):wait_until_navigated() local item = tab:get_storage("translationHash") :: string print(item) browser:close()
58
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/examples/print-to-pdf.luau
luau
.luau
local process = require("@lune/process") local fs = require("@lune/fs") local chrome = require("../src") local WEBSOCKET_URL = assert(process.args[1], "Must provide websocket url") local FILE_PATH = assert(process.args[2], "Must provide path/to/file/index.html") local browser = chrome.browser.connect(WEBSOCKET_URL) l...
165
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/examples/query-wikipedia.luau
luau
.luau
local chrome = require("../src") local browser = chrome.browser.create({ -- The searchbar won't appear if the resolution is too low window_size = { width = 1600, height = 768 }, }) local function query(input: string) local tab = browser:create_tab() tab:navigate_to("https://en.wikipedia.org") :wait_until_navig...
191
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/examples/settings-and-event.luau
luau
.luau
local chrome = require("../src") local browser = chrome.browser.create({ headless = false }) local tab = browser:create_tab() tab:navigate_to("https://www.google.com"):wait_until_navigated() tab:add_event_listener(chrome.Event.PageLifecycleEvent, function(lifecycle) if lifecycle.name == "DOMContentLoaded" then pr...
77
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/examples/take-screenshot.luau
luau
.luau
local fs = require("@lune/fs") local chrome = require("../src") local browser = chrome.browser.create() local tab = browser:create_tab() local jpeg = tab:navigate_to("https://www.wikipedia.org") :wait_until_navigated() :capture_screenshot({ format = "jpeg", quality = 75, from_surface = true }) fs.writeFile("screens...
162
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/context.luau
luau
.luau
local types = require("./types") export type Context = types.Context local function get_id(context: Context): string return context.id end local function get_tabs(context: Context): { types.Tab } local tabs = {} for _, t in context.browser:get_tabs() do if t:get_browser_context_id() == context.id then table...
187
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/init.luau
luau
.luau
local proc = require("@self/proc") local browser = require("@self/browser") local context = require("@self/context") local tab = require("@self/tab") local polling = require("@self/util/polling") local Method = require("@self/protocol/method") local Event = require("@self/protocol/event") export type LaunchOptions = p...
143
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/proc.luau
luau
.luau
local process = require("@lune/process") local fs = require("@lune/fs") local net = require("@lune/net") local Regex = require("@lune/regex") local tempfile = require("./util/tempfile") local winreg = require("./util/winreg") --[=[ Represents the way in which Chrome is run. By default it will search for a Chrome bin...
2,661
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/tab/box-model.luau
luau
.luau
local types = require("../types") local Page = require("../protocol/page") export type BoxModel = types.BoxModel local function content_viewport(box_model: BoxModel): Page.Viewport return { x = box_model.content.top_left.x, y = box_model.content.top_left.y, width = box_model.content:width(), height = box_mod...
423
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/tab/dialog.luau
luau
.luau
local Transport = require("../transport") local Page = require("../protocol/page") export type Dialog = { session_id: string, transport: Transport.Transport, accept: (dialog: Dialog, text: string?) -> (), dismiss: (dialog: Dialog) -> (), } local function handle(dialog: Dialog, accept: boolean, text: string?) dia...
192
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/tab/element-quad.luau
luau
.luau
local types = require("../types") export type ElementQuad = types.ElementQuad local function height(element_quad: ElementQuad): number return element_quad.bottom_left.y - element_quad.top_left.y end local function width(element_quad: ElementQuad): number return element_quad.top_right.x - element_quad.top_left.x en...
928
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/tab/element.luau
luau
.luau
local element_quad = require("./element-quad") local box_model = require("./box-model") local polling = require("../util/polling") local types = require("../types") local DOM = require("../protocol/dom") local Runtime = require("../protocol/runtime") export type Element = types.Element local DEFAULT_TIMEOUT = 3 loca...
2,314
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/tab/keys.luau
luau
.luau
export type KeyDefinition = { code: string?, key: Key, key_code: number?, text: string?, } export type Key = "Tab" | "*" | "MediaPlayPause" | "`" | "Help" | "End" | "NonConvert" | "Alt" | '"' | "MediaTrackPrevious" | "F2" | "AltGraph" | "," | "|" | "Execute" | "t" | "Enter" | "." | "Meta" | "?"...
7,282
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/util/casing.luau
luau
.luau
local function transform(x: any, processor: (string) -> string): any if typeof(x) == "string" then return processor(x) elseif typeof(x) == "table" then local clone = {} for key, value in x do if typeof(value) == "table" then value = transform(value, processor) end clone[transform(key, processor)] ...
256
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/util/polling.luau
luau
.luau
local task = require("@lune/task") export type Polling = { timeout: number, sleep: number, pause_until: <T>(self: Polling, try: () -> T?) -> T?, } local DEFAULT_TIMEOUT = 10 local DEFAULT_SLEEP = 1 / 10 local function pause_until<T>(polling: Polling, try: () -> T?): T? local start = os.clock() while true do ...
265
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/util/tempfile.luau
luau
.luau
local process = require("@lune/process") local fs = require("@lune/fs") local NUM_RANDOM_CHARS = 6 local NUM_RETRIES = 2 ^ 31 local ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" local function assert_temp(): string if not process.env.TEMP then error("Missing TEMP variable") end if ...
265
synpixel/chrome.luau
synpixel-chrome.luau-8dacaf1/src/util/winreg.luau
luau
.luau
--[[ MIT License Copyright (c) 2024-present jiwonz 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, ...
1,097
Heliodex/coputer
Heliodex-coputer-9de2a35/ast/format/src/extension.ts
roblox-ts
.ts
// The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below import * as vscode from "vscode" import { formatContent, formatFile } from "./format" // This method is called when your extension is activated // Your extension is activated the...
435
brightluau/bright
brightluau-bright-76da13c/lune/lib/discover.luau
luau
.luau
local fs = require("@lune/fs") local joinPath = require("@lune-lib/joinPath") local function discover(root: string, extension: string?, exclusions: { string }?): { string } local discoveredFiles = {} local files = fs.readDir(root) for _, file in files do local fullPath = joinPath(root, file) if exclusions a...
182
brightluau/bright
brightluau-bright-76da13c/lune/lib/joinPath.luau
luau
.luau
local function joinPath(...): string return table.concat({ ... }, "/") end return joinPath
22
brightluau/bright
brightluau-bright-76da13c/lune/tests/init.luau
luau
.luau
local process = require("@lune/process") require("./license")() local consoleReporter = require("@lune-lib/reporter") consoleReporter.init() local frktest = require("@frktest/frktest") process.exit(if frktest.run() then 0 else 1)
59
brightluau/bright
brightluau-bright-76da13c/lune/tests/license.luau
luau
.luau
local frktest = require("@frktest/frktest") local test = frktest.test local check = frktest.assert.check local req = frktest.assert.require local fs = require("@lune/fs") local discover = require("@lune-lib/discover") local EXCLUDE = { "./src/vendor", } local LICENSE_HEADER = fs.readFile("./include/license-header....
168
brightluau/bright
brightluau-bright-76da13c/src/bin/argparse.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- -- whilst argparse has been patched to expose its types, pesde refuses to regenerate the linker script to expose ...
155
brightluau/bright
brightluau-bright-76da13c/src/bin/cli/init.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- local argparse = require("@cli/argparse") return { require("./cmd_init"), --require("./run"), require("./upda...
93
brightluau/bright
brightluau-bright-76da13c/src/bin/cli/run.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- local fs = require("@lune/fs") local argparse = require("@cli/argparse") local config = require("@cli/config") l...
514
brightluau/bright
brightluau-bright-76da13c/src/bin/cli/update.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- local fs = require("@lune/fs") local serde = require("@lune/serde") local argparse = require("@cli/argparse") lo...
354
brightluau/bright
brightluau-bright-76da13c/src/bin/config.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- local fs = require("@lune/fs") local serde = require("@lune/serde") local constants = require("./constants") ty...
258
brightluau/bright
brightluau-bright-76da13c/src/bin/main.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- local process = require("@lune/process") local argparse = require("./argparse") local cli = require("./cli") loc...
181
brightluau/bright
brightluau-bright-76da13c/src/lib/init.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- return { std = require("./std"), }
64
brightluau/bright
brightluau-bright-76da13c/src/lib/poke.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- -- we use the "pokemore" version of the library, which means it uses a CST to preserve things like comments via t...
114
brightluau/bright
brightluau-bright-76da13c/src/lib/std.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- local types = require("./types") -- re-export all of the types that would be most used export type Config<C> = t...
222
brightluau/bright
brightluau-bright-76da13c/src/lib/types.luau
luau
.luau
-- -- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not -- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -- --- Converts a configuration definition to a K/V pair of configuration options. export type function Config(userC...
677
brightluau/bright
brightluau-bright-76da13c/vendor/colorful/init.luau
luau
.luau
local ESCAPE = string.char(27) local ANSI_16 = `{ESCAPE}[%dm` export type Styler = (text: string) -> string local function createStylerFunction(opener: number, closer: number): Styler local open = string.format(ANSI_16, opener) local close = string.format(ANSI_16, closer) return function(text: string) return `{...
591
Ince-FS/Fast-Minkowski-Shapecast
Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Geometry/LinearConvexCast.luau
luau
.luau
--!native --!strict local MAX_ITERATIONS: number = 256 local function getABV( originA: CFrame, marginA: number, invA: CFrame, localSupportA: any, originB: CFrame, marginB: number, invB: CFrame, localSupportB: any, n: Vector3 ): (Vector3, Vector3, Vector3) local m = n:Dot(n) do if m > 0 then n /= m^0.5 end ...
1,183
Ince-FS/Fast-Minkowski-Shapecast
Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/Ball.luau
luau
.luau
--!strict type Ball = { Shape: string, Margin: number, Transform: CFrame, Radius: number, fromPart: (basePart: BasePart) -> Ball, localSupport: (n: Vector3) -> Vector3 } return function(): Ball local self: Ball = { Shape = 'Ball', Margin = 0, Transform = CFrame.identity, Radius = 0 } :: Ball f...
170
Ince-FS/Fast-Minkowski-Shapecast
Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/Block.luau
luau
.luau
--!strict type Block = { Shape: string, Margin: number, Transform: CFrame, Extent: Vector3, fromPart: (basePart: BasePart) -> Block, localSupport: (n: Vector3) -> Vector3 } return function(): Block local self: Block = { Shape = 'Block', Margin = 0, Transform = CFrame.identity, Extent = Vector3.zer...
214
Ince-FS/Fast-Minkowski-Shapecast
Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/CornerWedge.luau
luau
.luau
--!strict type CornerWedge = { Shape: string, Margin: number, Transform: CFrame, Extent: Vector3, fromPart: (basePart: BasePart) -> CornerWedge, localSupport: (n: Vector3) -> Vector3 } local _vertices: {Vector3} = { Vector3.new(1, 1, -1), Vector3.new(-1, -1, 1), Vector3.new(1, -1, -1), Vector3.new(-1, -1,...
332
Ince-FS/Fast-Minkowski-Shapecast
Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/Cylinder.luau
luau
.luau
--!strict type Cylinder = { Shape: string, Margin: number, Transform: CFrame, Height: number, Radius: number, fromPart: (basePart: BasePart) -> Cylinder, localSupport: (n: Vector3) -> Vector3 } return function(): Cylinder local self: Cylinder = { Shape = 'Cylinder', Margin = 0, Transform = CFrame.i...
268
Ince-FS/Fast-Minkowski-Shapecast
Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/Wedge.luau
luau
.luau
--!strict type Wedge = { Shape: string, Margin: number, Transform: CFrame, Extent: Vector3, fromPart: (basePart: BasePart) -> Wedge, localSupport: (n: Vector3) -> Vector3 } local _vertices: {Vector3} = { Vector3.new( 1, 1, 1), Vector3.new(-1, 1, 1), Vector3.new(-1, -1, 1), Vector3.new( 1, -1, -1), Ve...
345
Roblox/picomatch-lua
Roblox-picomatch-lua-6ae3cd7/bin/spec.lua
luau
.lua
local ProcessService = game:GetService("ProcessService") local Packages = script.Parent.PicomatchTestModel.Packages local JestGlobals = require(Packages.Dev.JestGlobals) local TestEZ = JestGlobals.TestEZ -- Run all tests, collect results, and report to stdout. local result = TestEZ.TestBootstrap:run( { Packages.Pic...
122
Roblox/picomatch-lua
Roblox-picomatch-lua-6ae3cd7/src/stringUtils.lua
luau
.lua
-- ROBLOX NOTE: no upstream -- ROBLOX TODO: implement in LuauPolyfill local CurrentModule = script.Parent local Packages = CurrentModule.Parent local LuauPolyfill = require(Packages.LuauPolyfill) local Array = LuauPolyfill.Array type Array<T> = LuauPolyfill.Array<T> local RegExp = require(Packages.RegExp) type RegEx...
451
RiskoZS/llz4
RiskoZS-llz4-57d8692/scripts/bench.lua
luau
.lua
local base64 = require("base64") local llz4 = require("llz4") local lz4 = require("lz4") local llzw = require("llzw") local data do local file = assert(io.open(assert(arg[1], "missing file name"), "r")) data = file:read("*a") file:close() end local function bench(which, compress, decompress, data) collectgarbage...
469
RiskoZS/llz4
RiskoZS-llz4-57d8692/scripts/bench.luau
luau
.luau
local base64 = require("../Base64") local llz4 = require("../llz4-luau") local llzw = require("../llzw-luau") local data = require("../luau-data")[1] local function bench(which, compress, decompress, data) collectgarbage() collectgarbage() local compressStart = os.clock() local compressed, a, b, c, d = compres...
462
RiskoZS/llz4
RiskoZS-llz4-57d8692/scripts/requireify.lua
luau
.lua
-- Turn an arbitrary file into a Lua file that returns a table with a string -- holding the contents of said file, so that it can be loaded by Luau. -- usage: lua requireify.lua <file> local filename = assert(arg[1], "missing filename") local file = assert(io.open(filename, "rb")) local data = file:read("*a") file:cl...
114
RiskoZS/llz4
RiskoZS-llz4-57d8692/scripts/test.lua
luau
.lua
local llz4 = require("../llz4-test") local str = (...) for acceleration = 1, 10 do local compressed = llz4.compress(str, acceleration) local decompressed = llz4.decompress(compressed) assert(decompressed == str, "decompressed doesn't match original") end
66
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/conformance/generated/google/protobuf/any.luau
luau
.luau
--!strict --!nolint LocalUnused --!nolint ImportUnused --# selene: allow(empty_if, if_same_then_else, manual_table_clone, unused_variable) -- This file was @autogenerated by protoc-gen-luau local proto = require("../../proto") local typeRegistry = require("../../proto/typeRegistry") type _Messages = { Any: _AnyMessag...
1,761
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/conformance/generated/google/protobuf/duration.luau
luau
.luau
--!strict --!nolint LocalUnused --!nolint ImportUnused --# selene: allow(empty_if, if_same_then_else, manual_table_clone, unused_variable) -- This file was @autogenerated by protoc-gen-luau local proto = require("../../proto") local typeRegistry = require("../../proto/typeRegistry") type _Messages = { Duration: _Dura...
1,719
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/conformance/generated/google/protobuf/field_mask.luau
luau
.luau
--!strict --!nolint LocalUnused --!nolint ImportUnused --# selene: allow(empty_if, if_same_then_else, manual_table_clone, unused_variable) -- This file was @autogenerated by protoc-gen-luau local proto = require("../../proto") local typeRegistry = require("../../proto/typeRegistry") type _Messages = { FieldMask: _Fie...
906
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/conformance/generated/google/protobuf/struct.luau
luau
.luau
--!strict --!nolint LocalUnused --!nolint ImportUnused --# selene: allow(empty_if, if_same_then_else, manual_table_clone, unused_variable) -- This file was @autogenerated by protoc-gen-luau local proto = require("../../proto") local typeRegistry = require("../../proto/typeRegistry") type _Messages = { Struct: _Struct...
4,925
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/conformance/generated/google/protobuf/timestamp.luau
luau
.luau
--!strict --!nolint LocalUnused --!nolint ImportUnused --# selene: allow(empty_if, if_same_then_else, manual_table_clone, unused_variable) -- This file was @autogenerated by protoc-gen-luau local proto = require("../../proto") local typeRegistry = require("../../proto/typeRegistry") type _Messages = { Timestamp: _Tim...
1,613
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/conformance/generated/google/protobuf/wrappers.luau
luau
.luau
--!strict --!nolint LocalUnused --!nolint ImportUnused --# selene: allow(empty_if, if_same_then_else, manual_table_clone, unused_variable) -- This file was @autogenerated by protoc-gen-luau local proto = require("../../proto") local typeRegistry = require("../../proto/typeRegistry") type _Messages = { DoubleValue: _D...
7,084
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/conformance/jsonEncode.luau
luau
.luau
--!strict local serde = require("@lune/serde") local function isArray(input: { [any]: any }) local count = 0 for _ in input do count += 1 end return count == #input end -- Re-implementation of jsonEncode that guarantees JSON etc are round tripped local function jsonEncode(input: any): string if typeof(input) ...
274
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/proto/init.test.luau
luau
.luau
--!strict -- TODO: This file is NOT RAN! Needs to be fixed in a properly run test file. local proto = require("@self") local function assertEquals<T>(x: T, y: T) if x ~= y then error(`{x} ~= {y}`, 2) end end local function formatHex(input: string): string local bytes = {} for index = 1, #input do table.inser...
1,451
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/Any.luau
luau
.luau
function _AnyImpl.jsonEncode(input: Any): { [string]: any } local unpacked = input:unpack(typeRegistry.default) assert(unpacked ~= nil, "Cannot JSON-encode empty Any") local json = unpacked:jsonEncode() if typeof(json) == "string" then return { ["@type"] = input.type_url, ["value"] = json } end json["@type"]...
331
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/Any_methods.luau
luau
.luau
function _AnyImpl.pack(payload: proto.Message<any, any>, typeUrlPrefix: string): Any return _AnyImpl.new({ type_url = typeUrlPrefix .. "/" .. payload.descriptor.fullName, value = payload:encode(), }) end -- Luau: It refuses to believe these are the same unpack, for some reason local anyUnpack: typeof(({} :: _Any...
325
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/BytesValue.luau
luau
.luau
function _BytesValueImpl.jsonEncode(self: BytesValue): string return buffer.tostring(self.value) end function _BytesValueImpl.jsonDecode(anyValue: any): BytesValue local value: string = anyValue return _BytesValueImpl.new({ value = buffer.fromstring(value), }) end
65
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/Duration.luau
luau
.luau
-- Converts a number of nanos to a string representation. -- Sign and trailing zeroes are dropped. -- 500000000 -> ".5s" -- 500000001 -> ".500000001s" -- 0 -> ".0s" -- 1 -> ".000000001s" -- -1 -> "-.000000001s" local function serializeFractionalNanos(nanos: number): string nanos = nanos * math.sign(nanos) local nano...
793
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/FieldMask.luau
luau
.luau
function _FieldMaskImpl.jsonEncode(fieldMask: FieldMask): string return table.concat(fieldMask.paths, ",") end function _FieldMaskImpl.jsonDecode(anyInput: any): FieldMask local input: string = anyInput local paths = {} for path in string.gmatch(input, "[^,]+") do table.insert(paths, path) end return _FieldM...
94
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/ListValue.luau
luau
.luau
function _ListValueImpl.jsonEncode(list: ListValue): { any } local serialized = {} for _, value in list.values do table.insert(serialized, messages.Value.jsonEncode(value)) end return serialized end function _ListValueImpl.jsonDecode(anyValue: any): ListValue local input: { any } = anyValue local values = {...
111
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/Struct.luau
luau
.luau
function _StructImpl.jsonEncode(struct: Struct): { [string]: any } local serialized = {} for key, value in struct.fields do serialized[key] = messages.Value.jsonEncode(value) end return serialized end function _StructImpl.jsonDecode(input: { [string]: any }): Struct local fields = {} for key, serializedValu...
107
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/Timestamp.luau
luau
.luau
local function serializeFractionalNanos(nanos: number): string if nanos % 1e6 == 0 then return string.format(".%03d", nanos) elseif nanos % 1e3 == 0 then return string.format(".%06d", nanos) else return string.format(".%09d", nanos) end end local function deserializeFractionalNanos(nanosText: string): number...
685
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/luau/wkt_mixins/Value.luau
luau
.luau
function _ValueImpl.jsonEncode(input: Value): any local kind = input.kind if kind == nil or kind.type == "null_value" then return nil elseif kind.type == "number_value" or kind.type == "string_value" or kind.type == "bool_value" then return kind.value elseif kind.type == "list_value" then return messages.Lis...
412
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/tests/basic.luau
luau
.luau
--!strict local tests = require("./tests") local deeper_include_me2 = require("./samples/deeper/include_me2") local forwards_compatibility = require("./samples/forwards_compatibility") local include_me = require("./samples/include_me") local kitchen_sink = require("./samples/kitchen_sink") local recursive = require("....
1,424
Kampfkarren/protoc-gen-luau
Kampfkarren-protoc-gen-luau-83ff174/src/tests/field_case.luau
luau
.luau
--!strict -- Validates that generated protos preserve field names as-is when no field_name_case option is passed. local tests = require("./tests") local field_case_test = require("./samples/field_case_test") local assertEquals = tests.assertEquals local describe = tests.describe local it = tests.it describe("field_nam...
276