repo
stringclasses
350 values
file_path
stringlengths
29
200
language
stringclasses
2 values
file_type
stringclasses
4 values
code
stringlengths
2
1.01M
tokens
int64
2
598k
Roblox/data-stores-batch-processor-cli
Roblox-data-stores-batch-processor-cli-27c6164/src/util/stage1-util.luau
luau
.luau
--!strict --[[ This module handles the creation and management of stage 1 tasks for batch processing. ]] -- Native Libraries local process = require('@lune/process') -- External Libraries local llc_tasks = require('../../libs/llc_tasks/tasks') -- Local Libraries local CLIO = require('./clio') local Constants = ...
1,678
Roblox/data-stores-batch-processor-cli
Roblox-data-stores-batch-processor-cli-27c6164/src/util/stage2-util.luau
luau
.luau
--!strict --[[ This module handles the creation and management of stage 2 tasks for batch processing. ]] -- Native Libraries local process = require('@lune/process') -- External Libraries local llc_tasks = require('../../libs/llc_tasks/tasks') -- Local Libraries local CLIO = require('./clio') local Constants = ...
1,457
Roblox/data-stores-batch-processor-cli
Roblox-data-stores-batch-processor-cli-27c6164/src/util/table-util.luau
luau
.luau
--!strict --[[ Formats arguments into fixed-width blocks with separators. ]] -- Local Libraries local Constants = require('../shared/constants') -- TableUtil local TableUtil = {} --[[ Formats a value to fit within a block of specified width. If the value is too long, it will be truncated with "...". ...
470
Roblox/data-stores-batch-processor-cli
Roblox-data-stores-batch-processor-cli-27c6164/src/util/time-util.luau
luau
.luau
--!strict --[[ Time utility for handling Unix timestamps and datetime formatting. ]] -- Native Libraries local datetime = require("@lune/datetime") -- TimeUtil local TimeUtil = {} --[[ Converts a Unix timestamp in milliseconds to a DateTime string. @param timestamp number - Unix timestamp in millisecond...
123
hardlyardi/b226
hardlyardi-b226-aeef4f0/lune/tests.luau
luau
.luau
local SPEC_DIRECTORY = "./tests/_specs" local MATCH_SPEC_FILE = "%.spec%.luau$" local RESULTS_DIRECTORY = "./_SUITE" local filesystem = require("@lune/fs") local filesystem_hierarchy = require("@runtest/utils/filesystem_hierarchy") local process = require("@lune/process") local runtest = require("@runtest/") local ser...
825
hardlyardi/b226
hardlyardi-b226-aeef4f0/src/init.luau
luau
.luau
--!optimize 2 --!native --[[ - U53: Represents a positive integer with a number (a.k.a., double, or F64) value. 2^53 is the maximum unsigned integer a number in luau can accurately represent. Used primarily for entity Ids. - U32: Represents a positive integer, and implies it can or should be used with bit32 or other ...
34,793
hardlyardi/b226
hardlyardi-b226-aeef4f0/tests/runtest/utils/colorful.luau
luau
.luau
--[[ Copyright 2024 ffrostfall Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublic...
807
hardlyardi/b226
hardlyardi-b226-aeef4f0/tests/runtest/utils/luausignal.luau
luau
.luau
--[[ Copyright 2025 ffrostfall Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublic...
1,539
hardlyardi/b226
hardlyardi-b226-aeef4f0/tests/utils/ecs.luau
luau
.luau
local b2 = require("@b2/") return b2.ecs(true :: true, true :: true)
23
hardlyardi/b226
hardlyardi-b226-aeef4f0/tests/utils/ecs_visualizer.luau
luau
.luau
local b2 = require("@b2/") local ecs = require("./ecs") local runtest = require("@runtest/") type Ent = b2.Ent local style = runtest.util.style local color = style.color local b2i = b2.internal local ecsi = ecs.internal local pretty_print = style.from_epsilon local indent_newlines = style.indent_newlines -- local bri...
1,617
hardlyardi/b226
hardlyardi-b226-aeef4f0/tests/utils/spec.luau
luau
.luau
--[[ simple util for creating specs ]] local runtest = require("@runtest/") type SpecRunner = runtest.SpecRunner type SpecInterface = runtest.SpecInterface type TestInterface = runtest.TestInterface type LoadedSpec = runtest.LoadedSpec local function serve(PASSED: SpecRunner) local spec = runtest.test.spec.init(PASS...
199
checkraisefold/warmluau
checkraisefold-warmluau-8299341/cli/command.luau
luau
.luau
-- warmluau -- darklua but warm and luau -- by checkraisefold local PROJECT_FILE_EXTENSION = "warm.luau" local PROJECT_FILE_MATCH = "^(.*)%.warm%.luau?$" local cli = require("@batteries/cli") local defs = require("@warmluau/") local filesystem = require("@lute/fs") local fspath = require("@util/fspath") local luau = r...
1,261
checkraisefold/warmluau
checkraisefold-warmluau-8299341/cli/options.luau
luau
.luau
local cli = require("@batteries/cli") local function add_options(parser: cli.Parser) parser:add("help", "flag", { help = "get help", aliases = { "h" }, }) parser:add("version", "flag", { help = "get the version", aliases = { "v" }, }) parser:add("bake", "flag", { help = "base mode (bake)", aliases = {...
266
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/ingredients/append_comment.luau
luau
.luau
local warmluau = require("@warmluau/") export type Mode = "early" | "late" export type Opts = { text: string, mode: Mode?, } return {} :: warmluau.Ingredient<Opts>
53
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/ingredients/resolve_constant.luau
luau
.luau
local analyzer = require("@util/syntax/analyzer") local warmluau = require("@warmluau/") export type ImportValue = | string -- | number | boolean | vector export type ImportChain = { value: ImportValue | { literal: analyzer.ConstantData, }?, index: { [string]: ImportValue | ImportChain, }?, _const: analy...
127
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/ingredients/resolve_control.luau
luau
.luau
local warmluau = require("@warmluau/") export type Opts = { functions: boolean?, variables: boolean?, branches: boolean?, loops: boolean?, } return {} :: warmluau.Ingredient<Opts>
55
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/ingredients/resolve_require.luau
luau
.luau
local warmluau = require("@warmluau/") export type IndexingStyle = "waitforchild" | "property" export type Opts = { sourcemap_path: string, indexing: IndexingStyle?, } return {} :: warmluau.Ingredient<Opts>
64
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/init.luau
luau
.luau
local filesystem = require("@lute/fs") local parser = require("@util/syntax/parser") export type Ast = parser.Ast export type AstExpr = parser.AstExpr export type Parsley = parser.Parsley export type LoadedProject = (require: <Path>(target: Path, ...never) -> unknown) -> ...unknown export type File = { read parsed:...
467
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/syntax/analyzer.luau
luau
.luau
local analyzer = require("@util/syntax/analyzer") export type UnaryOperator = analyzer.UnaryOperator export type BinaryOperator = analyzer.BinaryOperator export type UnknownConstant = analyzer.UnknownConstant export type NilConstant = analyzer.NilConstant export type BooleanConstant = analyzer.BooleanConstant export t...
151
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/syntax/parser.luau
luau
.luau
local parser = require("@util/syntax/parser") export type Ast = parser.Ast export type AstExpr = parser.AstExpr export type Parsley = parser.Parsley return {} :: typeof(parser)
44
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/syntax/printer.luau
luau
.luau
local printer = require("@util/syntax/printer") return {} :: typeof(printer)
18
checkraisefold/warmluau
checkraisefold-warmluau-8299341/defs/syntax/visitors.luau
luau
.luau
local visitors = require("@util/syntax/visitors") export type Base<State = unknown> = visitors.Base<State> export type AddType = visitors.AddType export type AddScope = visitors.AddScope export type Create<State = unknown> = visitors.Create<State> return {} :: typeof(visitors)
61
checkraisefold/warmluau
checkraisefold-warmluau-8299341/ext/batteries/cli.luau
luau
.luau
local cli = {} cli.__index = cli type ArgKind = "positional" | "flag" | "option" type ArgOptions = { help: string?, aliases: { string }?, default: string?, required: boolean?, } type ArgData = { name: string, kind: ArgKind, options: ArgOptions, } type ParseResult = { values: { [string]: string }, flags: { [...
1,137
checkraisefold/warmluau
checkraisefold-warmluau-8299341/ext/batteries/pp.luau
luau
.luau
type ExistingOptions = { rawStrings: boolean?, } local isPrimitiveType = { string = true, number = true, boolean = true } local typeSortOrder: { [string]: number } = { ["boolean"] = 1, ["number"] = 2, ["string"] = 3, ["function"] = 4, ["vector"] = 5, ["buffer"] = 6, ["thread"] = 7, ["table"] = 8, ["userdata...
1,213
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/ingredients/append_comment/init.luau
luau
.luau
local append_comment = require("@warmluau/ingredients/append_comment") local luau = require("@lute/luau") local visitors = require("@util/syntax/visitors") local warmluau = require("@warmluau/") type Opts = append_comment.Opts type Mode = append_comment.Mode -- Luau local function INSERT<Item>(tbl: { Item }, value: I...
415
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/ingredients/resolve_constant/replacer.luau
luau
.luau
local luau = require("@lute/luau") local visitors = require("@util/syntax/visitors") export type Processor = (luau.AstExpr) -> luau.AstExpr? type VisitorState = Processor local function EXHAUSTIVE_MATCH<Msg>(value: never, msg: Msg?): never error(msg or `Unknown value in exhaustive match: {value}`) end local value_v...
1,607
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/ingredients/resolve_require/init.luau
luau
.luau
local REQUIRE_GLOBAL = "require" local DEFAULT_INDEXING_STYLE: IndexingStyle = "property" local convert_require = require("@warmluau/ingredients/resolve_require") local defs = require("@warmluau/") local filesystem = require("@lute/fs") local fspath = require("@util/fspath") local json = require("@batteries/json") loc...
1,276
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/meta.luau
luau
.luau
return { version = "pre-v0.1.0", default_project_name = "default.warm.luau", }
25
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/oven/init.luau
luau
.luau
local FAILED_OUTPUT_FILE = "return error('warmluau could not generate an output for this file');" local defs = require("@warmluau/") local filesystem = require("@lute/fs") local fspath = require("@util/fspath") local luau = require("@lute/luau") local styled = require("@util/pretty_print") type Process = index<defs.P...
1,584
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/oven/recipe.luau
luau
.luau
local defs = require("@warmluau/") local function recipe_create(...: defs.Recipe | defs.PreparedIngredient): defs.Recipe local steps: { defs.Recipe | defs.PreparedIngredient } = { ... } local steps_count = #steps local function recipe_add(adding: { defs.Recipe | defs.PreparedIngredient }): () local adding_count ...
136
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/require_vfs.luau
luau
.luau
local IMPL: any = nil local defs = require("@warmluau/") local requirer = require("@util/requirer") local dst = requirer.override local function dir<Children>(children: Children): Children local children = children :: { [string]: unknown } for index, value in children do children[index] = dst(index, value) end ...
231
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/fspath/init.luau
luau
.luau
local system = require("@lute/system") local types = require("@self/types") export type Nav = types.Nav export type ValidPath = types.ValidPath return (if system.os:lower():match("windows") then require("@self/windows") else require("@self/unix")) :: types.Api
62
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/fspath/types.luau
luau
.luau
export type Nav = { string } export type ValidPath = Nav | string export type Api = { to_nav: (path: ValidPath) -> Nav, from_str: (path: string) -> Nav, clone_nav: (path: ValidPath) -> Nav, to_str: (path: ValidPath) -> string, from_nav: (path: Nav) -> string, has_root: (path: ValidPath) -> boolean, absolute_eh:...
271
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/fspath/unix.luau
luau
.luau
local NAVIGATE_BACK = ".." local NAVIGATE_HERE = "." local SEPARATOR_MATCH = "/+" local SEPARATOR = "/" local types = require("./types") type ValidPath = types.ValidPath type Nav = types.Nav type Api = types.Api local function to_nav(path: ValidPath): Nav if type(path) == "table" then return path end return (st...
1,487
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/fspath/windows.luau
luau
.luau
--!optimize 2 --!native local NAVIGATE_BACK = ".." local NAVIGATE_HERE = "." local SEPARATOR_MATCH = "[/\\]+" local SEPARATOR = "/" local types = require("./types") type ValidPath = types.ValidPath type Nav = types.Nav type Api = types.Api local function to_nav(path: ValidPath): Nav if type(path) == "table" then ...
1,539
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/pretty_print/init.luau
luau
.luau
local INDENT = " " local DEFAULT_PRETTY_PRINT_DECIMALS = 4 -- scientific notation is in base 10, this is the closest power of 10 above 2^53 which is the max integer an f64 (luau -- number) can accurately represent. local SCIENTIFIC_NOTATION_THRESHOLD = 10 ^ 16 local colorful = require("./colorful") local color = co...
1,551
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/require_resolver/get_aliases.luau
luau
.luau
local filesystem = require("@lute/fs") local fspath = require("@util/fspath") local json = require("@batteries/json") local process = require("@lute/process") local resolver_types = require("./types") local styled = require("@util/pretty_print") type RequireAliases = resolver_types.RequireAliases local function ASSER...
636
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/require_resolver/init.luau
luau
.luau
local ALIAS_PATTERN = `^@(.+)` local filesystem = require("@lute/fs") local fspath = require("@util/fspath") local get_aliases = require("@self/get_aliases") local resolver_types = require("@self/types") type RequireAliases = resolver_types.RequireAliases local function ASSERT<Value>(value: Value, message: string?) ...
1,001
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/require_resolver/types.luau
luau
.luau
export type RequireAliases = { [string]: string } return nil
14
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/requirer/init.luau
luau
.luau
local PREPEND = [[math.randomseed(0); local require = ...;]] local filesystem = require("@lute/fs") local fspath = require("@util/fspath") local luau = require("@lute/luau") local override = require("@self/override") local require_resolver = require("@util/require_resolver") local styled = require("@util/pretty_print"...
661
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/requirer/override.luau
luau
.luau
local fspath = require("@util/fspath") local override = {} local metatable = { __index = override } type InternalIdentity = setmetatable<{ children: { [string]: InternalIdentity }, path: fspath.Nav, value: unknown?, }, typeof(metatable)> export type Identity<Children = { [string]: InternalIdentity }> = InternalId...
145
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/sourcemap/init.luau
luau
.luau
local pretty_print = require("@util/pretty_print") export type Node = { name: string, filePaths: { string }?, children: { Node }?, } local function ASSERT<Value, Message>(value: Value, message: Message?) if value then return value end error(message, 2) end -- save repetitive allocations local reused_nodes_li...
419
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/syntax/analyzer/defs.luau
luau
.luau
local luau = require("@lute/luau") export type UnaryOperator = "not" | "-" | "#" export type BinaryOperator = | "^" | "*" | "/" | "//" | "%" | "+" | "-" | ".." | "<" | ">" | "<=" | ">=" | "~=" | "==" | "and" | "or" export type UnknownConstant = { read kind: "unknown", read data: nil, } export type ...
480
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/syntax/analyzer/init.luau
luau
.luau
local defs = require("@self/defs") local luau = require("@lute/luau") local var_tracking = require("@self/var_tracking") export type UnaryOperator = defs.UnaryOperator export type BinaryOperator = defs.BinaryOperator export type UnknownConstant = defs.UnknownConstant export type NilConstant = defs.NilConstant export t...
4,492
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/syntax/analyzer/var_tracking.luau
luau
.luau
local defs = require("./defs") local luau = require("@lute/luau") local visitors = require("@util/syntax/visitors") type Variable = defs.Variable type Tracked = defs.Tracked type Scope = { [string]: Variable? } type VisitorState = { tracked: Tracked, scopes: { Scope }, } -- Luau local function INSERT<Item>(tbl: {...
947
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/syntax/parser.luau
luau
.luau
--!strict local luau = require("@lute/luau") export type Ast = luau.AstStatBlock export type AstExpr = luau.AstExpr export type Parsley = { root: Ast, eof: luau.Eof, } local function parse(source: string): Ast return luau.parse(source).root end local function parseexpr(source: string): AstExpr return luau.parsee...
148
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/syntax/tokentool.luau
luau
.luau
local luau = require("@lute/luau") local visitors = require("@util/syntax/visitors") local first_last_visitor = visitors.create() :: visitors.Create<{ first: luau.Token, last: luau.Token, }?> function first_last_visitor.vtoken(node): () local state = first_last_visitor.state if state then state.last = node els...
585
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/syntax/triviatool.luau
luau
.luau
local luau = require("@lute/luau") local visitors = require("@util/syntax/visitors") type VisitorState = { leading: { luau.Trivia }, trailing: { luau.Trivia }, } local visitor = visitors.create() :: visitors.Create<VisitorState> local function add_token(token: luau.Token<string>): () local leading = token.leadingt...
639
checkraisefold/warmluau
checkraisefold-warmluau-8299341/src/util/syntax/visitors.luau
luau
.luau
local luau = require("@lute/luau") export type Base<State = unknown> = { state: State, read visit_ast_block: (self: Base<State>, node: luau.AstStatBlock, state: State) -> State, read visit_ast_statement: (self: Base<State>, node: luau.AstStat, state: State) -> State, read visit_ast_expression: (self: Base<State>,...
7,995
Crazyblox/pajamas
Crazyblox-pajamas-1a297b2/Roblox/plugin/event.luau
luau
.luau
--!strict --!native --[[ Pajamas plugin - event: A simple event module that provides an agnostic interface for a pajamas project to hook up to a serial or parallel loop event determined by the host runtime. ]] export type Hook = { Connect: (Hook, boolean?) -> (), Disconnect: (Hook) -> () } local RunService =...
239
Crazyblox/pajamas
Crazyblox-pajamas-1a297b2/Roblox/plugin/input.luau
luau
.luau
--!strict --!native --[[ Pajamas plugin - input: A simple keyboard input module providing an agnostic interface for a pajamas project to react to keyboard user intent. Note: No method for disconnection keyboard input yet. It is currently assumed that a pajamas project runs for as long as the host runtime is...
218
Crazyblox/pajamas
Crazyblox-pajamas-1a297b2/Roblox/plugin/task.luau
luau
.luau
--!strict --!native --[[ Pajamas plugin - task: Takes advantage of the Luau runtime's own task library. This plugin also considers if sync/desync support is present. ]] assert( task, "This Luau runtime does not provide 'task'" ) local synchronize = task.synchronize or function() print("Warning: Missing sync/desy...
216
Crazyblox/pajamas
Crazyblox-pajamas-1a297b2/Roblox/wrapper/client.client.luau
luau
.luau
--!strict --!native -- Disable local iswrapper = script.Parent:FindFirstChild("iswrapper") if iswrapper then if require(iswrapper).Disable == true then script.Disabled = true return end end -- Wrapper local Attributes: {[string]: any} = script:GetAttributes() local Params: {[number]: any} = {} local i: number = 1...
137
Crazyblox/pajamas
Crazyblox-pajamas-1a297b2/Roblox/wrapper/iswrapper.luau
luau
.luau
-- Crude validation for existing in the wrapper directory in -- the face of datamodel properties not syncing outside of Roblox. return table.freeze( { Disable = true } )
36
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/bin/spec.lua
luau
.lua
local ProcessService = game:GetService("ProcessService") local Root = script.Parent.LuauPolyfillTestModel local Packages = Root.Packages -- Load JestRoblox source into Packages folder so it's next to Roact as expected local TestEZ = require(Packages._Workspace:FindFirstChild("TestEZ", true)) -- Run all tests, collect...
141
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/boolean/src/init.lua
luau
.lua
--!strict return { toJSBoolean = require(script.toJSBoolean), }
17
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/boolean/src/toJSBoolean.lua
luau
.lua
--!strict local Packages = script.Parent.Parent local Number = require(Packages.Number) -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean return function(val: any): boolean return not not val and val ~= 0 and val ~= "" and not Number.isNaN(val) end
70
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/concat.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local isArray = require(Array.isArray) local types = require(Packages.ES7Types) type Array<T> = types.Array<T> local RECEIVED_OBJECT_ERROR = "Array.concat(...) only works with array-like tables but " .. "it received ...
457
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/every.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Object = types.Object type callbackFn<T> = (element: T, index: number, array: Array<T>) -> boolean type callbackFnWithThisArg<T, U> = (self: ...
367
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/filter.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Object = types.Object type callbackFn<T> = (element: T, index: number, array: Array<T>) -> boolean type callbackFnWithThisArg<T, U> = (thisAr...
415
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/find.lua
luau
.lua
--!strict local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type PredicateFunction<T> = (value: T, index: number, array: Array<T>) -> boolean return function<T>(array: Array<T>, predicate: PredicateFunction<T>): T | nil for i = 1, ...
121
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/findIndex.lua
luau
.lua
--!strict local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type PredicateFunction<T> = (T, number, Array<T>) -> boolean return function<T>(array: Array<T>, predicate: PredicateFunction<T>): number for i = 1, #array do local elem...
114
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/flat.lua
luau
.lua
local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local isArray = require(Array.isArray) local types = require(Packages.ES7Types) type Array<T> = types.Array<T> local function flat<T>(array: Array<T>, depth_: number?): Array<T> if __DEV__ then if typeof(array) ~= "table" the...
251
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/flatMap.lua
luau
.lua
local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local flat = require(Array.flat) local map = require(Array.map) local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type callbackFn<T, U> = (element: T, index: number, array: Array<T>) -> U type callbackFnWit...
237
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/forEach.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Object = types.Object type callbackFn<T> = (element: T, index: number, array: Array<T>) -> () type callbackFnWithThisArg<T, U> = (thisArg: U,...
361
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/from/fromArray.lua
luau
.lua
--!strict local Array = script.Parent.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Object = types.Object type Array<T> = types.Array<T> type mapFn<T, U> = (element: T, index: number) -> U type mapFnWithThisArg<T, U> = (thisArg: any, element: T, index: number) -> U return f...
312
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/from/fromMap.lua
luau
.lua
--!strict local Array = script.Parent.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Object = types.Object type Array<T> = types.Array<T> type Map<K, V> = types.Map<K, V> type mapFn<T, U> = (element: T, index: number) -> U type mapFnWithThisArg<T, U> = (thisArg: any, element: ...
320
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/from/fromSet.lua
luau
.lua
--!strict local Array = script.Parent.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Object = types.Object type Array<T> = types.Array<T> type Set<T> = types.Set<T> type mapFn<T, U> = (element: T, index: number) -> U type mapFnWithThisArg<T, U> = (thisArg: any, element: T, ind...
295
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/from/fromString.lua
luau
.lua
--!strict local Array = script.Parent.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Object = types.Object type Array<T> = types.Array<T> type mapFn<T, U> = (element: T, index: number) -> U type mapFnWithThisArg<T, U> = (thisArg: any, element: T, index: number) -> U return f...
334
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/from/init.lua
luau
.lua
--!strict local Array = script.Parent local Collections = Array.Parent local Packages = Collections.Parent local Set = require(Collections.Set) local Map = require(Collections.Map.Map) local isArray = require(Array.isArray) local instanceof = require(Packages.InstanceOf) local types = require(Packages.ES7Types) local ...
423
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/includes.lua
luau
.lua
--!strict local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> local indexOf = require(script.Parent.indexOf) return function<T>(array: Array<T>, searchElement: T, fromIndex: number?): boolean return indexOf(array, searchElement, from...
82
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/indexOf.lua
luau
.lua
--!strict local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> -- Implements equivalent functionality to JavaScript's `array.indexOf`, -- implementing the interface and behaviors defined at: -- https://developer.mozilla.org/en-US/docs/...
260
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/init.lua
luau
.lua
--!strict local Packages = script.Parent.Parent local ES7Types = require(Packages.ES7Types) export type Array<T> = ES7Types.Array<T> return { concat = require(script.concat), every = require(script.every), filter = require(script.filter), find = require(script.find), findIndex = require(script.findIndex), flat ...
189
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/isArray.lua
luau
.lua
--!strict return function(value: any): boolean if typeof(value) ~= "table" then return false end if next(value) == nil then -- an empty table is an empty array return true end local length = #value if length == 0 then return false end local count = 0 local sum = 0 for key in pairs(value) do if ty...
164
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/join.lua
luau
.lua
--!strict local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> local map = require(Array.map) return function<T>(arr: Array<T>, separator: string?): string if #arr == 0 then return "" end -- JS does tostring conversion implicitely...
122
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/map.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Object = types.Object type callbackFn<T, U> = (element: T, index: number, array: Array<T>) -> U type callbackFnWithThisArg<T, U, V> = (thisAr...
382
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/reduce.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type reduceFn<T, U> = (previousValue: U, currentValue: T, currentIndex: number, array: Array<T>) -> U -- Implements Javascript's `Array.prototype...
332
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/reverse.lua
luau
.lua
--!strict -- https://programming-idioms.org/idiom/19/reverse-a-list/1314/lua local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> return function<T>(t: Array<T>): Array<T> local n = #t local i = 1 while i < n do t[i], t[n] = t[n],...
127
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/shift.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local isArray = require(Array.isArray) local types = require(Packages.ES7Types) type Array<T> = types.Array<T> return function<T>(value: Array<T>): T? if __DEV__ then if not isArray(value) then error(string.form...
128
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/slice.lua
luau
.lua
--!strict local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> -- Implements Javascript's `Array.prototype.slice` as defined below, but with 1-indexing -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects...
315
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/some.lua
luau
.lua
--!strict local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Object = types.Object -- note: JS version can return anything that's truthy, but that won't work for us since Lua deviates (0 is truthy) type callbackFn<T> = (element:...
342
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/sort.lua
luau
.lua
--!strict local Array = script.Parent local Collections = Array.Parent local Packages = Collections.Parent local None = require(Collections.Object.None) local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Comparable = (any, any) -> number local defaultSort = function<T>(a: T, b: T): boolean re...
302
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/splice.lua
luau
.lua
--!strict local Array = script.Parent local Packages = Array.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> -- Implements equivalent functionality to JavaScript's `array.splice`, including -- the interface and behaviors defined at: -- https://developer.mozilla.org/en-US/docs/Web/...
454
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Array/unshift.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Array = script.Parent local Packages = Array.Parent.Parent local isArray = require(Array.isArray) local types = require(Packages.ES7Types) type Array<T> = types.Array<T> return function<T>(array: Array<T>, ...: T): number if __DEV__ then if not isArray(array) then error...
166
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Map/Map.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Collections = script.Parent.Parent local Packages = Collections.Parent local arrayForEach = require(Collections.Array.forEach) local arrayMap = require(Collections.Array.map) local isArray = require(Collections.Array.isArray) local instanceof = require(Packages.InstanceOf) lo...
1,438
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Map/coerceToMap.lua
luau
.lua
local MapModule = script.Parent local Collections = MapModule.Parent local Packages = Collections.Parent local Map = require(MapModule.Map) local Object = require(Collections.Object) local instanceOf = require(Packages.InstanceOf) local types = require(Packages.ES7Types) type Map<K, V> = types.Map<K, V> type Table<K,...
160
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Map/coerceToTable.lua
luau
.lua
local MapModule = script.Parent local Collections = MapModule.Parent local Packages = Collections.Parent local Map = require(MapModule.Map) local instanceOf = require(Packages.InstanceOf) local arrayReduce = require(Collections.Array.reduce) local types = require(Packages.ES7Types) type Map<K, V> = types.Map<K, V> ty...
178
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Map/init.lua
luau
.lua
local Packages = script.Parent.Parent local ES7Types = require(Packages.ES7Types) local Map = require(script.Map) local coerceToMap = require(script.coerceToMap) local coerceToTable = require(script.coerceToTable) export type Map<K, V> = ES7Types.Map<K, V> return { Map = Map, coerceToMap = coerceToMap, coerceToT...
94
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Object/assign.lua
luau
.lua
--!strict local Object = script.Parent local Packages = Object.Parent.Parent local None = require(Object.None) local types = require(Packages.ES7Types) type Object = types.Object --[[ Merges values from zero or more tables onto a target table. If a value is set to None, it will instead be removed from the table. ...
528
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Object/freeze.lua
luau
.lua
--!strict local Object = script.Parent local Packages = Object.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Object = types.Object return function<T>(t: T & (Object | Array<any>)): T -- Luau FIXME: model freeze better so it passes through the type constraint and doesn't e...
97
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Object/init.lua
luau
.lua
--!strict return { assign = require(script.assign), entries = require(script.entries), freeze = require(script.freeze), is = require(script.is), isFrozen = require(script.isFrozen), keys = require(script.keys), preventExtensions = require(script.preventExtensions), seal = require(script.seal), values = requir...
107
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Object/isFrozen.lua
luau
.lua
--!strict local __DEV__ = _G.__DEV__ local Object = script.Parent local Packages = Object.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Object = types.Object return function(t: Object | Array<any>): boolean if __DEV__ then print("Luau now has a direct table.isfrozen cal...
106
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Object/keys.lua
luau
.lua
local Object = script.Parent local Collections = Object.Parent local Packages = Object.Parent.Parent local Set = require(Collections.Set) local types = require(Packages.ES7Types) local instanceOf = require(Packages.InstanceOf) type Array<T> = types.Array<T> type Set<T> = types.Set<T> type Table = { [any]: any } retur...
221
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Object/preventExtensions.lua
luau
.lua
--!strict local Object = script.Parent local Packages = Object.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> type Object = types.Object -- FIXME: This should be updated to be closer to the actual -- `Object.preventExtensions` functionality in JS. This requires additional -- sup...
187
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Object/values.lua
luau
.lua
--!strict local Object = script.Parent local Packages = Object.Parent.Parent local types = require(Packages.ES7Types) type Array<T> = types.Array<T> -- TODO Luau: needs overloads to model this more correctly return function<T>(value: { [string]: T } | Array<T> | string): Array<T> | Array<string> if value == nil then...
240
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/Set/init.lua
luau
.lua
--!nonstrict local __DEV__ = _G.__DEV__ local Collections = script.Parent local Packages = Collections.Parent local inspect = require(Collections.inspect) local isArray = require(Collections.Array.isArray) local arrayForEach = require(Collections.Array.forEach) local arrayFromString = require(Collections.Array.from.fr...
1,067
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/WeakMap.lua
luau
.lua
--!strict local Collections = script.Parent local Packages = Collections.Parent local ES7Types = require(Packages.ES7Types) type WeakMap<K, V> = ES7Types.WeakMap<K, V> type WeakMapPrivate<K, V> = { _weakMap: { [K]: V }, -- method definitions get: (self: WeakMapPrivate<K, V>, K) -> V, set: (self: WeakMapPrivate<K...
305
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/collections/src/init.lua
luau
.lua
--!strict local Packages = script.Parent local Array = require(script.Array) local Map = require(script.Map) local Object = require(script.Object) local Set = require(script.Set) local WeakMap = require(script.WeakMap) local inspect = require(script.inspect) local types = require(Packages.ES7Types) export type Array...
180
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/console/src/init.lua
luau
.lua
--!strict local makeConsoleImpl = require(script.makeConsoleImpl) return makeConsoleImpl()
20
Roblox/luau-polyfill
Roblox-luau-polyfill-d4798c6/modules/console/src/makeConsoleImpl.lua
luau
.lua
--!strict local root = script.Parent local Packages = root.Parent local inspect = require(Packages.Collections).inspect local INDENT = " " return function() local console = {} local indentDepth = 0 local function indent() return string.rep(INDENT, indentDepth) end function console.log(content, ...) local ...
525