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
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/hooks/lifecycle-used.luau
luau
.luau
local lifecycles = require("../../lifecycles") local types = require("../types") local callbacks: { (root: types.Self, provider: lifecycles.Lifecycle) -> () } = {} local function onLifecycleUsed(listener: (root: types.Root, lifecycle: lifecycles.Lifecycle) -> ()): () -> () table.insert(callbacks, listener) return f...
115
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/hooks/provider-used.luau
luau
.luau
local providers = require("../../providers") local types = require("../types") local callbacks: { (root: types.Self, provider: providers.Provider<unknown>) -> () } = {} local function onProviderUsed(listener: (root: types.Root, provider: providers.Provider<unknown>) -> ()): () -> () table.insert(callbacks, listener)...
108
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/hooks/root-constructing.luau
luau
.luau
local types = require("../types") local callbacks: { (root: types.Self) -> () } = {} local function onRootConstructing(listener: (root: types.Root) -> ()): () -> () table.insert(callbacks, listener) return function() table.remove(callbacks, table.find(callbacks, listener)) end end return table.freeze({ callbac...
90
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/hooks/root-destroyed.luau
luau
.luau
local types = require("../types") local callbacks: { (root: types.Self) -> () } = {} local function onRootDestroyed(listener: (root: types.Root) -> ()): () -> () table.insert(callbacks, listener) return function() table.remove(callbacks, table.find(callbacks, listener)) end end return table.freeze({ callbacks ...
87
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/hooks/root-finished.luau
luau
.luau
local types = require("../types") local callbacks: { (root: types.Self) -> () } = {} local function onRootFinished(listener: (root: types.Root) -> ()): () -> () table.insert(callbacks, listener) return function() table.remove(callbacks, table.find(callbacks, listener)) end end return table.freeze({ callbacks =...
87
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/hooks/root-started.luau
luau
.luau
local types = require("../types") local callbacks: { (root: types.Self) -> () } = {} local function onRootStarted(listener: (root: types.Root) -> ()): () -> () table.insert(callbacks, listener) return function() table.remove(callbacks, table.find(callbacks, listener)) end end return table.freeze({ callbacks = ...
87
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/hooks/root-used.luau
luau
.luau
local types = require("../types") local callbacks: { (root: types.Self, subRoot: types.Root) -> () } = {} local function onRootUsed(listener: (root: types.Root, subRoot: types.Root) -> ()): () -> () table.insert(callbacks, listener) return function() table.remove(callbacks, table.find(callbacks, listener)) end e...
99
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/init.luau
luau
.luau
local create = require("@self/create") local lifecycleUsed = require("@self/hooks/lifecycle-used") local providerUsed = require("@self/hooks/provider-used") local rootConstructing = require("@self/hooks/root-constructing") local rootDestroyed = require("@self/hooks/root-destroyed") local rootFinished = require("@self/h...
220
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/logger.luau
luau
.luau
local logger = require("../logger") return logger.create("@prvdmwrong/roots", logger.standardErrorInfoUrl("roots"), { useAfterDestroy = "Cannot use Root after it is destroyed.", alreadyDestroyed = "Cannot destroy an already destroyed Root.", alreadyFinished = "Root has already finished.", })
63
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/destroy.luau
luau
.luau
local logger = require("../logger") local types = require("../types") local function destroy(root: types.Self) if root._destroyed then logger:fatalError({ template = logger.alreadyDestroyed }) end root._destroyed = true table.clear(root._rootLifecycles) table.clear(root._rootProviders) table.clear(root._subRoo...
94
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/start.luau
luau
.luau
local dependencies = require("../../dependencies") local lifecycles = require("../../lifecycles") local logger = require("../logger") local providers = require("../../providers") local rootFinished = require("../hooks/root-finished").callbacks local rootStarted = require("../hooks/root-started").callbacks local types =...
716
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/use-lifecycle.luau
luau
.luau
local lifecycleUsed = require("../hooks/lifecycle-used").callbacks local lifecycles = require("../../lifecycles") local runtime = require("../../runtime") local types = require("../types") local threadpool = runtime.threadpool local function useLifecycle(root: types.Self, lifecycle: lifecycles.Lifecycle) table.inser...
98
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/use-lifecycles.luau
luau
.luau
local lifecycleUsed = require("../hooks/lifecycle-used").callbacks local lifecycles = require("../../lifecycles") local runtime = require("../../runtime") local types = require("../types") local threadpool = runtime.threadpool local function useLifecycles(root: types.Self, lifecycles: { lifecycles.Lifecycle }) for _...
120
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/use-module.luau
luau
.luau
local providerUsed = require("../hooks/provider-used").callbacks local providers = require("../../providers") local runtime = require("../../runtime") local types = require("../types") local threadpool = runtime.threadpool local providerClasses = providers._.providerClasses local function useModule(root: types.Self, ...
144
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/use-modules.luau
luau
.luau
local providerUsed = require("../hooks/provider-used").callbacks local providers = require("../../providers") local runtime = require("../../runtime") local types = require("../types") local threadpool = runtime.threadpool local providerClasses = providers._.providerClasses local function useModules(root: types.Self,...
193
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/use-provider.luau
luau
.luau
local providerUsed = require("../hooks/provider-used").callbacks local providers = require("../../providers") local runtime = require("../../runtime") local types = require("../types") local threadpool = runtime.threadpool local function useProvider(root: types.Self, provider: providers.Provider<unknown>) root._root...
88
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/use-providers.luau
luau
.luau
local providerUsed = require("../hooks/provider-used").callbacks local providers = require("../../providers") local runtime = require("../../runtime") local types = require("../types") local threadpool = runtime.threadpool local function useProviders(root: types.Self, providers: { providers.Provider<unknown> }) for ...
101
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/use-root.luau
luau
.luau
local rootUsed = require("../hooks/root-used").callbacks local runtime = require("../../runtime") local types = require("../types") local threadpool = runtime.threadpool local function useRoot(root: types.Self, subRoot: types.Root) root._subRoots[subRoot] = true threadpool.spawnCallbacks(rootUsed, root, subRoot) r...
82
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/use-roots.luau
luau
.luau
local rootUsed = require("../hooks/root-used").callbacks local runtime = require("../../runtime") local types = require("../types") local threadpool = runtime.threadpool local function useRoots(root: types.Self, subRoots: { types.Root }) for _, subRoot in subRoots do root._subRoots[subRoot] = true threadpool.spa...
100
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/will-finish.luau
luau
.luau
local types = require("../types") local function willFinish(root: types.Self, callback: () -> ()) root._finish:register(callback) return root end return willFinish
38
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/methods/will-start.luau
luau
.luau
local types = require("../types") local function willStart(root: types.Self, callback: () -> ()) root._start:register(callback) return root end return willStart
38
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/prvd.config.luau
luau
.luau
local configure = require("@lune-lib/configure") return configure.package({ name = "roots", description = "Roots implementation for Prvd 'M Wrong", types = { Root = true, StartedRoot = true, }, dependencies = configure.dependencies({ dependencies = true, logger = true, lifecycles = true, runtime = t...
91
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/roots/types.luau
luau
.luau
local lifecycles = require("../lifecycles") local providers = require("../providers") type Set<T> = { [T]: true } export type Root = { type: "Root", start: (root: Root) -> StartedRoot, useModule: (root: Root, module: ModuleScript) -> Root, useModules: (root: Root, modules: { Instance }, predicate: ((ModuleScrip...
342
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/batteries/threadpool.luau
luau
.luau
local task = require("../libs/task") local freeThreads: { thread } = {} local function run<T...>(f: (T...) -> (), thread: thread, ...) f(...) table.insert(freeThreads, thread) end local function yielder() while true do run(coroutine.yield()) end end local function spawn<T...>(f: (T...) -> (), ...: T...) loca...
201
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/implementations/init.luau
luau
.luau
local types = require("@self/../types") type Implementation<T> = { new: (() -> T)?, implementation: T? } export type RuntimeName = "roblox" | "luau" | "lune" | "lute" | "seal" | "zune" local supportedRuntimes = table.freeze({ roblox = require("@self/roblox"), luau = require("@self/luau"), lune = require("@self/lu...
395
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/implementations/luau.luau
luau
.luau
local types = require("../types") return types.Runtime({ name = "luau", priority = -1, is = function() return true end, })
34
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/implementations/lune.luau
luau
.luau
local types = require("../types") local LUNE_VERSION_FORMAT = "(Lune) (%d+%.%d+%.%d+.*)+(%d+)" return types.Runtime({ name = "lune", is = function() return string.match(_VERSION, LUNE_VERSION_FORMAT) ~= nil end, })
66
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/implementations/lute.luau
luau
.luau
local types = require("../types") return types.Runtime({ name = "lute", is = function() return false end, })
28
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/implementations/roblox.luau
luau
.luau
local types = require("../types") return types.Runtime({ name = "roblox", is = function() -- wtf return not not (_VERSION == "Luau" and game and workspace) end, })
46
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/implementations/seal.luau
luau
.luau
local types = require("../types") return types.Runtime({ name = "seal", is = function() return false end, })
28
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/implementations/zune.luau
luau
.luau
local types = require("../types") local ZUNE_VERSION_FORMAT = "(Zune) (%d+%.%d+%.%d+.*)+(%d+%.%d+)" return types.Runtime({ name = "zune", is = function() return string.match(_VERSION, ZUNE_VERSION_FORMAT) ~= nil end, })
70
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/init.luau
luau
.luau
local implementations = require("@self/implementations") local task = require("@self/libs/task") local threadpool = require("@self/batteries/threadpool") local warn = require("@self/libs/warn") export type RuntimeName = implementations.RuntimeName return table.freeze({ name = implementations.currentRuntimeName, ta...
78
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/libs/task.luau
luau
.luau
local implementations = require("../implementations") export type TaskLib = { cancel: (thread) -> (), defer: <T...>(functionOrThread: thread | (T...) -> (), T...) -> thread, delay: <T...>(duration: number, functionOrThread: thread | (T...) -> (), T...) -> thread, spawn: <T...>(functionOrThread: thread | (T...) -> ...
1,053
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/libs/warn.luau
luau
.luau
local implementations = require("../implementations") local supportedRuntimes = implementations.supportedRuntimes local implementFunction = implementations.implementFunction local function tostringTuple(...: any) local stringified = {} for index = 1, select("#", ...) do table.insert(stringified, tostring(select(i...
177
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/prvd.config.luau
luau
.luau
local configure = require("@lune-lib/configure") return configure.package({ name = "runtime", description = "Runtime agnostic libraries for Prvd 'M Wrong", types = { RuntimeName = true, }, })
46
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/runtime/types.luau
luau
.luau
export type Runtime = { name: string, priority: number?, is: () -> boolean, } local function Runtime(x: Runtime) return table.freeze(x) end return table.freeze({ Runtime = Runtime, })
44
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/packages/typecheckers/prvd.config.luau
luau
.luau
local configure = require("@lune-lib/configure") return configure.package({ name = "typecheckers", description = "Typechecking primitives and compatibility for Prvd 'M Wrong", })
38
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/build.luau
luau
.luau
local fs = require("@lune/fs") local h = require("./h") local path = require("@lune-lib/utils/path") local process = require("@lune/process") local siteUrls = require("@sitegen/config/site-urls") local sitemap = require("@sitegen/config/sitemap") local rootPath = process.args[1] pcall(fs.removeDir, "site") fs.copy(pa...
196
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/components/article.luau
luau
.luau
local Document = require("./document") local h = require("@sitegen/h") local siteBaseUrl = require("@sitegen/utils/site-base-url") export type ArticleSection = { title: string, content: { h.Child }, sections: { ArticleSection }?, } local headings = { h.h1, h.h2, h.h3, h.h4, h.h5, h.h6, } local defaultHeadin...
335
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/components/button.luau
luau
.luau
local h = require("@sitegen/h") local function Button(props: { href: string, [number]: h.Child, }) return h.a({ href = props.href, class = "button", table.unpack(props), }) end return Button
56
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/components/code-snippet.luau
luau
.luau
local h = require("@sitegen/h") local function CodeSnippet(props: { language: "lua" | "shell" | "typescript", [number]: h.Child, }) return h.pre({ class = `code-snippet`, h.code({ class = `language-{props.language}`, table.unpack(props), }), }) end return CodeSnippet
80
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/components/document.luau
luau
.luau
local Navbar = require("@sitegen/components/navbar") local h = require("@sitegen/h") local siteBaseUrl = require("@sitegen/utils/site-base-url") local function Document(props: { title: string?, main: h.Child, header: h.Child?, extraHead: h.Child?, }) return { "<!DOCTYPE html>", h.html({ lang = "en", h.h...
424
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/components/navbar.luau
luau
.luau
local forEach = require("@sitegen/utils/for-each") local h = require("@sitegen/h") local navPages = require("@sitegen/config/nav-pages") local siteBaseUrl = require("@sitegen/utils/site-base-url") local function Navbar() return h.nav({ class = "navbar", h.div({ class = "navbar-inner", h.a({ href = sit...
145
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/config/common-urls.luau
luau
.luau
return { rossThread = "https://discord.com/channels/385151591524597761/1267055070374268969", }
30
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/config/nav-pages.luau
luau
.luau
local siteBaseUrl = require("@sitegen/utils/site-base-url") export type NavPage = { id: string, href: string, title: string, } return { { id = "learn", href = siteBaseUrl("learn"), title = "Learn", }, { id = "api", href = siteBaseUrl("api"), title = "API", }, { id = "releases", href = siteBase...
144
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/config/site-urls.luau
luau
.luau
local path = require("@lune-lib/utils/path") local process = require("@lune/process") return { base = if process.env.IS_CI then "https://prvdmwrong.luau.page/" else path(process.cwd, "site"), }
50
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/config/sitemap.luau
luau
.luau
local h = require("@sitegen/h") export type SitemapEntry<Props = nil> = { path: string, render: (Props) -> h.Child, props: Props, } local sitemap: { SitemapEntry<any> } = { { path = "", render = require("@sitegen/pages/index") }, { path = "learn", render = require("@sitegen/pages/learn/index") }, { path = "lear...
112
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/h.luau
luau
.luau
export type Child = string | { Child } local function flatten(child: Child): string if typeof(child) == "string" then return child else local flat = "" for _, sub_child in child do flat ..= flatten(sub_child) end return flat end end local function escape(attribute: string): string attribute = string....
840
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/pages/learn/index.luau
luau
.luau
local Article = require("@sitegen/components/article") local commonUrls = require("@sitegen/config/common-urls") local h = require("@sitegen/h") return function() return Article({ title = "Learn Prvd 'M Wrong", content = { h.p("Congratulations on choosing Prvd 'M Wrong, you’re finally making good decisions!"),...
547
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/pages/learn/installation.luau
luau
.luau
local Article = require("@sitegen/components/article") local commonUrls = require("@sitegen/config/common-urls") local h = require("@sitegen/h") return function() return Article({ title = "Installation", content = { h.p("Prvd 'M Wrong is distributed as several packages that needs to be installed into \ ...
168
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/utils/for-each.luau
luau
.luau
local function forEach<KI, KO, VI, VO>(input: { [KI]: VI }, func: (KI, VI) -> (KO, VO)): { [KO]: VO } local output = {} for keyIn, valueIn in input do local keyOut, valueOut = func(keyIn, valueIn) if keyOut == nil or valueOut == nil then continue end assert(output[keyOut] == nil, "Key collision") output[...
119
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/sitegen/utils/site-base-url.luau
luau
.luau
local siteUrls = require("@sitegen/config/site-urls") local function siteBaseUrl(suffix: string) return siteUrls.base .. "/" .. suffix end return siteBaseUrl
36
welcomestohell/prvdmwrong
welcomestohell-prvdmwrong-a935ae2/types/g.d.luau
luau
.luau
declare _G: { PRVDMWRONG_SUPPRESS_MULTIPLE_SAME_TAG: unknown, PRVDMWRONG_DISALLOW_MULTIPLE_LISTENERS: unknown, PRVDMWRONG_PROFILE_LIFECYCLES: unknown }
53
Roblox/rocale-cli
Roblox-rocale-cli-ad165e9/scripts/build.luau
luau
.luau
local args = { ... } local version = args[2] or "unknown" local hash = args[3] or "unknown" local fs = require("@std/fs") local system = require("@lute/system") local log = require("../src/util/log") log.setLevel("debug") local runProcess = require("../src/util/runProcess") if not fs.exists("build") then fs.create...
231
Roblox/rocale-cli
Roblox-rocale-cli-ad165e9/scripts/test.luau
luau
.luau
local process = require("@lute/process") local fs = require("@std/fs") local log = require("../src/util/log") log.setLevel("debug") local runProcess = require("../src/util/runProcess") runProcess( "build/rocale-cli", "run", "--script", "tests/run-test-project.luau", "--placeId", process.env.TEST_PLACE_ID, "--...
266
Roblox/rocale-cli
Roblox-rocale-cli-ad165e9/src/cli.luau
luau
.luau
local args = { ... } local runCommand = require("./commands/run") local versionInfo = require("./version") local function helpCommand() print([[ rocale-cli A command-line tool for building, uploading, and running Roblox projects in Open Cloud. USAGE: rocale-cli <command> [options] COMMANDS: run Build, upl...
175
Roblox/rocale-cli
Roblox-rocale-cli-ad165e9/src/commands/run.luau
luau
.luau
local function help() print([[ rocale-cli run Build, upload, and run a Roblox project in Open Cloud USAGE: rocale-cli run [options] REQUIRED: -u, --universeId <id> Target universe ID to spawn an Open Cloud instance of -p, --placeId <id> Target place ID to spawn an Open Cloud instance of --apiK...
1,684
Roblox/rocale-cli
Roblox-rocale-cli-ad165e9/src/util/log.luau
luau
.luau
--[[ Simple logger module. ]] local richterm = require("@batteries/richterm") local process = require("@lute/process") local log = {} type Level = "trace" | "debug" | "info" | "warn" | "error" local dimBlueFormatter = richterm.combine(richterm.blue, richterm.dim) local currentLevel: Level = "info" local colorsEna...
823
Roblox/rocale-cli
Roblox-rocale-cli-ad165e9/src/util/runProcess.luau
luau
.luau
local process = require("@std/process") local system = require("@std/system") local log = require("../util/log") local isWin32 = string.lower(system.os) == "windows_nt" local function runProcess(...: string): string local cmd = { ... } if isWin32 then cmd[1] ..= ".exe" end local cmdStr = table.concat(cmd, " "...
181
Roblox/rocale-cli
Roblox-rocale-cli-ad165e9/tests/project/init.luau
luau
.luau
return true
3
Roblox/rocale-cli
Roblox-rocale-cli-ad165e9/tests/run-test-project.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local TestProject = require(ReplicatedStorage:FindFirstChild("TestProject")) assert(TestProject == true, "TestProject did not return true") local hello = _G.HELLO_GLOBAL or "" local world = _G.WORLD_GLOBAL or "" local output = { BinaryOutput = buffer.fr...
93
nezuo/spark
nezuo-spark-6d54423/examples/matter/src/client/exampleSystem.luau
luau
.luau
local function exampleSystem(_, state) local actions = state.actions -- Here we use the helper methods we added: justPressed and justReleased. if actions:justPressed("jump") then print("Jumped!") end if actions:justReleased("attack") then print("Attack released!") end local move = actions:clampedAxis2d("m...
103
nezuo/spark
nezuo-spark-6d54423/examples/matter/src/client/init.client.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local Matter = require(ReplicatedStorage.Packages.Matter) local Spark = require(ReplicatedStorage.Packages.Spark) local exampleSystem = require(script.exampleSystem) local updateInput = require(script.update...
341
nezuo/spark
nezuo-spark-6d54423/examples/matter/src/client/updateInput.luau
luau
.luau
local function updateInput(_, state) state.actions:update(state.inputState) state.inputState:clear() end return { system = updateInput, event = "RenderStepped", priority = -math.huge, -- You want to update input before all other systems run. }
57
nezuo/spark
nezuo-spark-6d54423/examples/minimal/src/client/init.client.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local Spark = require(ReplicatedStorage.Packages.Spark) local Actions = Spark.Actions local InputState = Spark.InputState local VirtualAxis2d = Spark.VirtualAxis2d local inputState = InputState.new() loca...
286
nezuo/spark
nezuo-spark-6d54423/examples/rebinding/src/client/UserInterface.luau
luau
.luau
local Players = game:GetService("Players") local UserInterface = {} function UserInterface.createRebindingMenu() local screenGui = Instance.new("ScreenGui") screenGui.Parent = Players.LocalPlayer.PlayerGui local background = Instance.new("Frame") background.AnchorPoint = Vector2.new(0.5, 0.5) background.Positio...
562
nezuo/spark
nezuo-spark-6d54423/examples/rebinding/src/client/init.client.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local UserInputService = game:GetService("UserInputService") local Spark = require(ReplicatedStorage.Packages.Spark) local UserInterface = require(script.UserInterface) local KeyboardBindings = require(ReplicatedStorage.Shared.KeyboardBindings) local Acti...
1,187
nezuo/spark
nezuo-spark-6d54423/examples/rebinding/src/server/init.server.luau
luau
.luau
local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local KeyboardBindings = require(ReplicatedStorage.Shared.KeyboardBindings) local allCustomizedBindings = {} local function onPlayerAdded(player) -- Here you would load the player's custom bindings using DataSt...
364
nezuo/spark
nezuo-spark-6d54423/examples/rebinding/src/shared/KeyboardBindings.luau
luau
.luau
return { jump = { name = "Jump", action = "jump", default = Enum.KeyCode.Space }, moveUp = { name = "Move Up", action = "move", direction = "up", default = Enum.KeyCode.W }, moveDown = { name = "Move Down", action = "move", direction = "down", default = Enum.KeyCode.S }, moveLeft = { name = "Move Left", action = "m...
127
nezuo/spark
nezuo-spark-6d54423/src/Actions.luau
luau
.luau
local UserInputService = game:GetService("UserInputService") local Bindings = require(script.Parent.Binding.Bindings) local Signal = require(script.Parent.Signal) local getDeviceFromInput = require(script.Parent.getDeviceFromInput) local function isInputInDevices(input, devices) if typeof(input) == "table" then if...
2,713
nezuo/spark
nezuo-spark-6d54423/src/Actions.test.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Spark = require(script.Parent) local VirtualAxis = require(script.Parent.VirtualAxis) local VirtualAxis2d = require(script.Parent.VirtualAxis2d) local MutableInputState = require(ReplicatedStorage.MutableInputState) local Actions = Spark.Actions re...
4,049
nezuo/spark
nezuo-spark-6d54423/src/Binding/ActionConfig.luau
luau
.luau
--[=[ `ActionConfig` allows you to configure an action with modifiers. ```lua local actions = Actions.new({ "look" }):setRebuildBindings(function(bindings) bindings:bind("look") -- ActionConfig is returned by Bindings:bind. :addModifiers(scale(0.5, Vector2.new(0.5, 0.5))) end) ``` @class ActionConfig ]=...
225
nezuo/spark
nezuo-spark-6d54423/src/Binding/Bind.luau
luau
.luau
--[=[ Allows you to add modifiers to a set of inputs. ```lua local actions = Actions.new({ "look" }):setRebuildBindings(function(bindings) bindings:bind( "look", Bind.new(Enum.KeyCode.Thumbstick2):addModifiers(scale(0.5, Vector2.new(0.5, 0.5))) ) end) ``` @class Bind ]=] local Bind = {} Bind.__index =...
219
nezuo/spark
nezuo-spark-6d54423/src/Binding/Bindings.luau
luau
.luau
local ActionConfig = require(script.Parent.ActionConfig) local Bind = require(script.Parent.Bind) --[=[ Bind inputs to actions. ```lua local actions = Actions.new({ "move", "jump" }):setRebuildBindings(function(bindings) bindings:bind("move", VirtualAxis2d.new({ up = Enum.KeyCode.W, down = Enum.KeyCode.S, ...
294
nezuo/spark
nezuo-spark-6d54423/src/InputState.luau
luau
.luau
local UserInputService = game:GetService("UserInputService") local Inputs = require(script.Parent.Inputs) --[=[ Stores input state derived from [UserInputService] and is used to update [Actions]. :::note You should only ever create one `InputState`. ::: @class InputState ]=] local InputState = {} InputState.__...
1,694
nezuo/spark
nezuo-spark-6d54423/src/Inputs.luau
luau
.luau
return { GAMEPAD_TRIGGERS = { [Enum.KeyCode.ButtonL2] = true, [Enum.KeyCode.ButtonR2] = true, }, GAMEPAD_BUTTONS = { [Enum.KeyCode.ButtonA] = true, [Enum.KeyCode.ButtonB] = true, [Enum.KeyCode.ButtonX] = true, [Enum.KeyCode.ButtonY] = true, [Enum.KeyCode.ButtonL1] = true, [Enum.KeyCode.ButtonL3] = tr...
259
nezuo/spark
nezuo-spark-6d54423/src/Modifiers/deadZone.luau
luau
.luau
local function scaledDeadZone(value: number, lowerThreshold: number): number local lowerBound = math.max(math.abs(value) - lowerThreshold, 0) local scaledValue = lowerBound / (1 - lowerThreshold) return math.min(scaledValue, 1) * math.sign(value) end --[=[ Applies a deadzone to the input, then rescales the remain...
466
nezuo/spark
nezuo-spark-6d54423/src/Modifiers/scale.luau
luau
.luau
--[=[ Scales the axis and axis2d values by the given scale factors. Use this to adjust the sensitivity of the input. @param axisScale number @param axis2dScale Vector2 @return Modifier @within Modifiers ]=] local function scale( axisScale: number, axis2dScale: Vector2 ): (pressed: boolean, axis: number, axis2...
142
nezuo/spark
nezuo-spark-6d54423/src/Rebind.luau
luau
.luau
local UserInputService = game:GetService("UserInputService") local getDeviceFromInput = require(script.Parent.getDeviceFromInput) local Inputs = require(script.Parent.Inputs) local Promise = require(script.Parent.Parent.Promise) --[=[ Queries for the first button a user presses. This is useful for rebinding based on...
726
nezuo/spark
nezuo-spark-6d54423/src/Signal.luau
luau
.luau
--[=[ @class Signal ]=] local Signal = {} Signal.__index = Signal function Signal.new() return setmetatable({ connections = {}, }, Signal) end function Signal:fire(...) for _, connection in self.connections do task.spawn(connection, ...) end end --[=[ @param connection function | thread @return () -> () -...
125
nezuo/spark
nezuo-spark-6d54423/src/getDeviceFromInput.luau
luau
.luau
--[=[ Returns the [Device] for the given input if it exists. @param input Button @return Device? @within Spark ]=] local function getDeviceFromInput(input) if typeof(input) ~= "EnumItem" then return nil end if input:IsA("UserInputType") then if string.match(input.Name, "^Gamepad") ~= nil then return "G...
208
nezuo/spark
nezuo-spark-6d54423/src/init.luau
luau
.luau
export type Button = Enum.KeyCode | Enum.UserInputType export type VirtualAxis = { kind: "VirtualAxis", positive: Button?, negative: Button?, } export type VirtualAxis2d = { kind: "VirtualAxis2d", up: Button?, down: Button?, left: Button?, right: Button?, } export type Input = Button | VirtualAxis | VirtualAxis...
1,234
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/ColdFusion.luau
luau
.luau
--!strict local _Package = script.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services local SoundService = game:GetService("SoundService") -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFusion")) -- Modules local Sounds = re...
4,321
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/Defaults.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFusion")) ...
458
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/Fusion.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFusion")) ...
1,084
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/React.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFusion")) ...
2,053
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/Roact.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFusion")) ...
2,038
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/Wrapper.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFusion")) ...
1,479
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/_Config.story.luau
luau
.luau
--!strict local _Package = script.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local Icons = require(_Packages:WaitForChild("MaterialIcons")) -- Modules local Style = require(_Package:WaitForChild("Style")) local Enums = requ...
1,004
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/_Theme.story.luau
luau
.luau
--!strict local _Package = script.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local Icons = require(_Packages:WaitForChild("MaterialIcons")) -- Modules local Style = require(_Package:WaitForChild("Style")) local Enums = requ...
705
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Badge/init.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits return { ColdFusion = require(script:WaitForChild("ColdFusion")), Fusion = require(script:WaitForChild("Fusion")), Wrapper = require(script:WaitForChild("Wrapper")), Roact = require(script:WaitForChild("Roact")), React = re...
91
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Base.luau
luau
.luau
--!strict local _Package = script.Parent.Parent.Parent local _Packages = _Package.Parent -- Services local SoundService = game:GetService("SoundService") local RunService = game:GetService("RunService") -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("...
4,502
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Chip/Assist/ColdFusion.luau
luau
.luau
--!strict local _Package = script.Parent.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFusion")) -- Modules local Types = require(_Package:WaitForChild("Types")) local Ba...
1,374
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Chip/Assist/Defaults.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFus...
525
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Chip/Assist/Fusion.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFus...
1,294
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Chip/Assist/React.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFus...
2,613
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Chip/Assist/Roact.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFus...
2,598
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Chip/Assist/Wrapper.luau
luau
.luau
--!strict -- this script was generated by the build system, please do not make manual edits local _Package = script.Parent.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local ColdFusion = require(_Packages:WaitForChild("ColdFus...
1,738
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Chip/Assist/_Config.story.luau
luau
.luau
--!strict local _Package = script.Parent.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) local Icons = require(_Packages:WaitForChild("MaterialIcons")) -- Modules local Style = require(_Package:WaitForChild("Style")) local Enums...
828
nightcycle/synthetic
nightcycle-synthetic-1a0c0d5/src/Component/Button/Chip/Assist/_Theme.story.luau
luau
.luau
--!strict local _Package = script.Parent.Parent.Parent.Parent.Parent local _Packages = _Package.Parent -- Services -- Packages local Maid = require(_Packages:WaitForChild("Maid")) -- Modules local Style = require(_Package:WaitForChild("Style")) local Enums = require(_Package:WaitForChild("Enums")) -- Types -- Constan...
713