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 |
|---|---|---|---|---|---|
kohltastrophe/flux | kohltastrophe-flux-db223ed/src/Selector.luau | luau | .luau | --!strict
local Graph = require("./Graph")
local new = Graph.new
local newValue = Graph.signal
local get = Graph.Node.get
local readDep = Graph.readDep
local rawDep = Graph.rawDep
local untrack = Graph.untrack
local retrack = Graph.retrack
local withOwner = Graph.withOwner
local setValue = Graph.Node.set
local isReac... | 1,208 |
kohltastrophe/flux | kohltastrophe-flux-db223ed/src/Store.luau | luau | .luau | --!strict
local Graph = require("./Graph")
local Compat = require("./Compat")
local new = Graph.new
local newValue = Graph.signal
local get = Graph.Node.get
local setValue = Graph.Node.set
local scope = Graph.scope
local withOwner = Graph.withOwner
local onDestroy = Graph.onDestroy
local isReactive = Graph.isReactive... | 4,444 |
kohltastrophe/flux | kohltastrophe-flux-db223ed/src/Type/init.luau | luau | .luau | local Graph = require("./Graph")
local Instances = require("@self/Instances")
export type Action = () -> ()
export type Consumer = (...any) -> ()
export type Producer = () -> ...any
export type Function = (...any) -> ...any
export type Map<T> = { [T]: any }
export type Symbol = { read type: "Symbol" }
type _ATTR = "... | 825 |
kohltastrophe/flux | kohltastrophe-flux-db223ed/src/Wrap.luau | luau | .luau | --!strict
local Graph = require("./Graph")
local isNode = Graph.isNode
local createNode = Graph.new
type function wrappedType(obj: type, node: type)
local nodeMT = node:metatable()
local nodeIndexer = node:indexer()
local function makeNode(value: type): type
local mt, indexer = nodeMT, nodeIndexer
if not mt ... | 641 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/arrays.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
return function()
test.suite("Arrays", function()
test.case("contains", function()
local a = { "one", "two", "three", "four", "five" }
check.array.contains(a, "eleven") -- check ... | 435 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/basic_assertions.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
local req = frktest.assert.require
return function()
test.suite("Passing", function()
test.case("The only passing test", function()
check.is_true(true)
end)
end)
test.suite(... | 470 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/errors.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
return function()
test.suite("Errors", function()
test.case("throwing", function()
error("some error") -- errors end a test
end)
test.case("should error", function()
... | 127 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/focus.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
-- use test.focus variants of the case/suire functions to temporarily skip all but one test/suite
return function()
-- can be used on suites to run only one suite
test.focus.suite("Only run me [suite]", fun... | 192 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/messages.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
local req = frktest.assert.require
local msg = frktest.assert.msg
return function()
test.suite("Messages", function()
test.case("Print message if assertion fails", function()
check.equal(10,... | 313 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/parametrized.luau | luau | .luau | -- parametrized testing, also known as 'data driven tests' or 'table driven tests'
-- quite popular in the golang community, is a style of testing where the data
-- and logic are separated so that you can run the same test logic on multiple
-- input/output pairs
local frktest = require("@frktest/frktest")
local test =... | 288 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/readme_demo/_run.luau | luau | .luau | function load_tests()
require("./the_test")()
end
function run_tests()
local frktest = require("@frktest/frktest")
local console_reporter = require("@frktest/reporters/console_reporter")
console_reporter.init()
frktest.run()
end
load_tests()
run_tests()
| 69 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/readme_demo/the_test.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
local req = frktest.assert.require
local msg = frktest.assert.msg
return function()
test.suite("A collection of tests", function()
test.case("A test that passes", function()
local exp = 4
... | 354 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/run/default.luau | luau | .luau | function load_tests()
-- tests execute in the order they are loaded
require("../suites_cases")()
require("../basic_assertions")()
require("../messages")()
require("../errors")()
require("../parametrized")()
require("../arrays")()
require("../tables")()
require("../skip")()
-- req... | 245 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/run/pesde_entrypoint.luau | luau | .luau | function load_tests()
require("../basic_assertions")()
end
function run_tests()
-- same as run, but uses the entrypoint.luau entrypoint script, like a pesde project would
local frktest = require("../../src/entrypoint")
local console_reporter = frktest.reporters.console_reporter
console_reporter.in... | 97 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/skip.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
-- use test.skip to not run suites/cases
return function()
-- can be used on suites to skip the entire suite
test.skip.suite("This suite will not run", function()
test.case("test 1", function()
... | 159 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/suites_cases.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
return function()
-- use suites to group test cases together
test.suite("A collection of test cases", function()
test.case("case 1", function()
check.is_true(false)
end)
... | 148 |
itsfrank/frktest | itsfrank-frktest-aa72048/examples/tables.luau | luau | .luau | local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
return function()
test.suite("Tables", function()
test.case("value equal", function()
local a = { foo = 1 }
local b = { foo = 1 }
local c = a
check.equal(... | 574 |
itsfrank/frktest | itsfrank-frktest-aa72048/src/assert.luau | luau | .luau | local types = require("./types")
type Failure = types.Failure
local _state = {}
_state.listeners = {}
_state.listeners.check_failed = {} :: { (Failure) -> nil }
_state.listeners.require_failed = {} :: { (Failure) -> nil }
_state.current_user_msg = nil :: string?
local test = require("./test")
function exec_listener... | 990 |
itsfrank/frktest | itsfrank-frktest-aa72048/src/assert_impl.luau | luau | .luau | local types = require("./types")
local utils = require("./utils")
type Failure = types.Failure
type DiffEntry<T> = types.DiffEntry<T>
type TableDiff = types.TableDiff
local assert_impl = {}
function make_failure(message: string): Failure
local file, line = debug.info(5, "sl")
return {
location = {
... | 1,810 |
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 |
Nicell/luau.page | Nicell-luau.page-5806bf9/scripts/update.luau | luau | .luau | local cf = require("./cloudflare")
local porkbun = require("./porkbun")
local cname = require("../cname")
local success, oldCname = pcall(function()
return require("../cname-old") :: cname.Entries
end)
if not success then
print("No old cname file found, creating a new one.")
oldCname = {}
end
local function intoE... | 382 |
Nicell/luau.page | Nicell-luau.page-5806bf9/site/build.luau | luau | .luau | local fs = require("@std/fs")
local site = require("./")
if not fs.exists("dist") then
fs.createDirectory("dist")
end
fs.writeStringToFile("dist/index.html", site())
| 42 |
Nicell/luau.page | Nicell-luau.page-5806bf9/site/dev.luau | luau | .luau | local net = require("@lute/net/server")
local fs = require("@std/fs")
local process = require("@std/process")
local task = require("@std/task")
process.run({ "lute", "site/build.luau" })
local server = net.serve(function()
return fs.readFileToString("dist/index.html")
end)
local watcher = fs.watch("site/init.luau")... | 133 |
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 |
Lovreware/Platinum | Lovreware-Platinum-7f415b3/examples/print.luau | luau | .luau | print("Hello world") | 5 |
Lovreware/Platinum | Lovreware-Platinum-7f415b3/examples/print2.luau | luau | .luau | while true do
end | 5 |
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-78e0c4e/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/tests/cases/blank.luau | luau | .luau | -- nothing should happen!
| 5 |
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 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/build.luau | luau | .luau | --[[
Used to build the rbxts version.
]]
--!strict
local fs = require("@lune/fs")
local SRC_PATH = "./src"
local OUT_PATH = "./rbxts/src"
local INCLUDE_PATH = `./rbxts/include`
local OTHER_INCLUDED_PATHS = {
"LICENSE.md",
"default.project.json"
}
if fs.isDir(OUT_PATH) then fs.removeDir(OUT_PATH) end
fs.w... | 391 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/rbxts/include/init.luau | luau | .luau | --!strict
--!optimize 2
local LexRsml = require(script.Lexer)
local ParseRsml = require(script.Parser)
local ConvertRsml = require(script.Converter)
local DefaultStyles = require(script.DefaultStyles)
local function Rsml(content: string, derives: { StyleSheet }?)
-- If the content is a `TemplateStringsArray`.
... | 144 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Colors/Brick.luau | luau | .luau | return {
["bc:white"] = Color3.fromRGB(242, 243, 243),
["bc:grey"] = Color3.fromRGB(161, 165, 162),
["bc:lightyellow"] = Color3.fromRGB(249, 233, 153),
["bc:brickyellow"] = Color3.fromRGB(215, 197, 154),
["bc:lightgreen"] = Color3.fromRGB(194, 218, 184),
["bc:lightreddishviolet"] = Color3.fromRGB(232, 186, 200),
... | 4,429 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Colors/Css.luau | luau | .luau | return {
["css:aliceblue"] = Color3.fromRGB(240, 248, 255),
["css:antiquewhite"] = Color3.fromRGB(250, 235, 215),
["css:aqua"] = Color3.fromRGB(0, 255, 255),
["css:aquamarine"] = Color3.fromRGB(127, 255, 212),
["css:azure"] = Color3.fromRGB(240, 255, 255),
["css:beige"] = Color3.fromRGB(245, 245... | 3,172 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Colors/Tailwind.luau | luau | .luau | return {
["tw:slate:50"] = Color3.fromRGB(248, 250, 252),
["tw:slate:100"] = Color3.fromRGB(241, 245, 249),
["tw:slate:200"] = Color3.fromRGB(226, 232, 240),
["tw:slate:300"] = Color3.fromRGB(203, 213, 225),
["tw:slate:400"] = Color3.fromRGB(148, 163, 184),
["tw:slate:500"] = Color3.fromRGB(100, 116, 139),
["tw:... | 5,803 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Converter.luau | luau | .luau | --!strict
--!optimize 2
--!native
local Parser = require(script.Parent.Parser)
type StyleParent = StyleSheet | StyleRule
local function ResolvePath(path: string, inst: Instance): Instance?
if string.match(path, "%.rsml$") then
path = string.sub(path, 1, #path - 5)
end
local sections = string.spl... | 1,119 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/DefaultStyles.luau | luau | .luau | local LexRsml = require(script.Parent.Lexer)
local ParseRsml = require(script.Parent.Parser)
local ConvertRsml = require(script.Parent.Converter)
-- We have to create an identical Rsml function from
-- init.luau to prevent circular dependency issues.
local function Rsml(content: string, derives: { StyleSheet }?)
... | 1,808 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Lexer.luau | luau | .luau | --!strict
--!optimize 2
--!native
--!nolint LocalShadow
export type TokenDefinition = {
Kind: TokenKind,
Pattern: string
}
export type Token = {
Kind: TokenKind,
Value: string
}
export type TokenKind =
"CommentMultiStart" |
"StringMultiStart" | "StringMultiEnd" |
"CommentSingle" |
... | 1,594 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Parser/DatatypeNone.luau | luau | .luau | export type DatatypeNone = { Kind: "None" }
local DATATYPE_NONE: DatatypeNone = { Kind = "None" }
return DATATYPE_NONE | 33 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Parser/TupleAnnotations/Ceil.luau | luau | .luau | --!strict
--!optimize 2
--!native
local DATATYPE_NONE = require(script.Parent.Parent.DatatypeNone)
type CeilFunction<T> = (from: T) -> T
type CeilFunctions = {
number: CeilFunction<number>,
UDim: CeilFunction<UDim>,
UDim2: CeilFunction<UDim2>,
Rect: CeilFunction<Rect>,
Vector2: CeilFunction<Vecto... | 703 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Parser/TupleAnnotations/ColorSeq.luau | luau | .luau | --!strict
--!optimize 2
--!native
--!nolint LocalShadow
--!nolint DuplicateLocal
local function DefaultIfNotType<T>(target: T, expectedType: string, default: T): T
return if type(target) ~= expectedType then default else target
end
local function DefaultIfNotTypeOf<T>(target: T, expectedType: string, default: T):... | 965 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Parser/TupleAnnotations/Floor.luau | luau | .luau | --!strict
--!optimize 2
--!native
local DATATYPE_NONE = require(script.Parent.Parent.DatatypeNone)
type FloorFunction<T> = (from: T) -> T
type FloorFunctions = {
number: FloorFunction<number>,
UDim: FloorFunction<UDim>,
UDim2: FloorFunction<UDim2>,
Rect: FloorFunction<Rect>,
Vector2: FloorFunctio... | 685 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Parser/TupleAnnotations/Lerp.luau | luau | .luau | --!strict
--!optimize 2
--!native
local DATATYPE_NONE = require(script.Parent.Parent.DatatypeNone)
type LerpFunction<T> = (from: T, to: T, time: number) -> T
type LerpFunctions = {
number: LerpFunction<number>,
UDim: LerpFunction<UDim>,
UDim2: LerpFunction<UDim2>,
Rect: LerpFunction<Rect>,
Vector... | 1,166 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Parser/TupleAnnotations/NumSeq.luau | luau | .luau | --!strict
--!optimize 2
--!native
--!nolint LocalShadow
--!nolint DuplicateLocal
local function DefaultIfNotType<T>(target: T, expectedType: string, default: T): T
return if type(target) ~= expectedType then default else target
end
local function DefaultIfNotTypeOf<T>(target: T, expectedType: string, default: T)... | 1,007 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Parser/TupleAnnotations/Round.luau | luau | .luau | --!strict
--!optimize 2
--!native
local DATATYPE_NONE = require(script.Parent.Parent.DatatypeNone)
type RoundFunction<T> = (from: T) -> T
type RoundFunctions = {
number: RoundFunction<number>,
UDim: RoundFunction<UDim>,
UDim2: RoundFunction<UDim2>,
Rect: RoundFunction<Rect>,
Vector2: RoundFunctio... | 685 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/Parser/init.luau | luau | .luau | --!strict
--!optimize 2
--!native
--!nolint LocalShadow
--!nolint DuplicateLocal
local Lexer = require(script.Parent.Lexer)
type Token = Lexer.Token
type TokenKind = Lexer.TokenKind
type Lexer = Lexer.Lexer
local Colors = script.Parent.Colors
local ColorsCss = require(Colors.Css)
local ColorsTailwind = require(Colors... | 13,993 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/src/init.luau | luau | .luau | --!strict
--!optimize 2
local LexRsml = require(script.Lexer)
local ParseRsml = require(script.Parser)
local ConvertRsml = require(script.Converter)
local DefaultStyles = require(script.DefaultStyles)
return function(content: string, derives: { StyleSheet }?)
return ConvertRsml(ParseRsml(LexRsml(content)), deriv... | 81 |
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.