repo
stringclasses
302 values
file_path
stringlengths
18
241
language
stringclasses
2 values
file_type
stringclasses
4 values
code
stringlengths
76
697k
tokens
int64
10
271k
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/atom.luau
luau
.luau
local store = require(script.Parent.store) local types = require(script.Parent.types) type Atom<T> = types.Atom<T> type AtomOptions<T> = types.AtomOptions<T> --[=[ Creates a new atom with the given state. @param state The initial state. @param options Optional configuration. @return A new atom. ]=] local functio...
227
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/computed.luau
luau
.luau
local atom = require(script.Parent.atom) local store = require(script.Parent.store) local types = require(script.Parent.types) type AtomOptions<T> = types.AtomOptions<T> type Selector<T> = types.Selector<T> --[=[ Creates a read-only atom that derives its state from one or more atoms. Used to avoid unnecessary recomp...
245
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/effect.luau
luau
.luau
local store = require(script.Parent.store) type Cleanup = () -> () --[=[ Runs the given callback immediately and whenever any atom it depends on changes. Returns a cleanup function that unsubscribes the callback. @param callback The function to run. @return A function that unsubscribes the callback. ]=] local f...
252
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/init.luau
luau
.luau
local atom = require(script.atom) local computed = require(script.computed) local effect = require(script.effect) local mapped = require(script.mapped) local observe = require(script.observe) local store = require(script.store) local subscribe = require(script.subscribe) local types = require(script.types) export type...
164
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/mapped.luau
luau
.luau
local atom = require(script.Parent.atom) local store = require(script.Parent.store) local subscribe = require(script.Parent.subscribe) local types = require(script.Parent.types) type Atom<T> = types.Atom<T> type Selector<T> = types.Selector<T> type Map = (<K0, V0, K1, V1>(fn: Selector<{ [K0]: V0 }>, mapper: (V0, K0) ...
660
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/observe.luau
luau
.luau
local store = require(script.Parent.store) local subscribe = require(script.Parent.subscribe) local types = require(script.Parent.types) type Selector<T> = types.Selector<T> local function noop() end --[=[ Creates an instance of `factory` for each item in the atom's state, and cleans up the instance when the item i...
318
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/store.luau
luau
.luau
local types = require(script.Parent.types) type Atom<T> = types.Atom<T> type Set<T> = types.Set<T> type WeakMap<K, V> = types.WeakMap<K, V> local __DEV__ = _G.__DEV__ local listeners: WeakMap<Atom<any>, WeakMap<() -> (), unknown>> = setmetatable({}, { __mode = "k" }) local batched: Set<() -> ()> = {} local batching ...
1,345
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/subscribe.luau
luau
.luau
local store = require(script.Parent.store) local types = require(script.Parent.types) type Selector<T> = types.Selector<T> --[=[ Subscribes to changes in the given atom or selector. The callback is called with the current state and the previous state immediately after a change occurs. @param callback The atom or...
244
littensy/charm
littensy-charm-d0b7cff/packages/charm/src/types.luau
luau
.luau
export type Set<T> = { [T]: true } export type WeakMap<K, V> = typeof(setmetatable({} :: { [K]: V }, { __mode = "k" })) --[=[ A primitive state container that can be read from and written to. When the state changes, all subscribers are notified. @param state The next state or a function that produces the next sta...
291
littensy/charm
littensy-charm-d0b7cff/packages/react/src/init.luau
luau
.luau
local Charm = require(script.Parent.Charm) local React = if script.Parent:FindFirstChild("react") then require(script.Parent.react) :: never else require(script.Parent.React) --[=[ A hook that subscribes to changes in the given atom or selector. The component is re-rendered whenever the state changes. If the `d...
207
littensy/charm
littensy-charm-d0b7cff/packages/vide/src/init.luau
luau
.luau
local Charm = require(script.Parent.Charm) local Vide = if script.Parent:FindFirstChild("vide") then require(script.Parent.vide.src) :: never else require(script.Parent.Vide) --[=[ Subscribes to the state of an atom and returns a Vide source. @param callback The atom or selector to subscribe to. @return The rea...
145
littensy/charm
littensy-charm-d0b7cff/tests/benchmarks/atom.bench.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Charm = require(ReplicatedStorage.DevPackages.Charm) local computed = Charm.computed local atom = Charm.atom return { ParameterGenerator = function() end, Functions = { atom = function() local state = atom(0) for _ = 1, 500 do state(m...
156
littensy/charm
littensy-charm-d0b7cff/tests/benchmarks/patch.bench.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local patch = require(ReplicatedStorage.DevPackages.CharmSync.patch) local USERS = 1000 local function generate() local users = {} for user = 1, USERS do users[user] = { coins = math.random(1, 2), gems = math.random(1, 2), } end return { ...
232
littensy/charm
littensy-charm-d0b7cff/tests/init.server.luau
luau
.luau
--!nocheck local ReplicatedStorage = game:GetService("ReplicatedStorage") local TestEZ = require(ReplicatedStorage.DevPackages.TestEZ) -- Start Charm in debug mode _G.__DEV__ = true require(ReplicatedStorage.DevPackages.Charm) require(ReplicatedStorage.DevPackages.CharmSync) _G.__DEV__ = false TestEZ.TestBootstrap:...
91
littensy/charm
littensy-charm-d0b7cff/tests/utils/collect.luau
luau
.luau
--[=[ Trigger a garbage collection cycle by allocating a large amount of junk memory and then waiting for the next frame. ]=] local function collect() for _ = 1, 1e4 do local _ = table.create(1e3) end task.wait() end return collect
64
littensy/charm
littensy-charm-d0b7cff/tests/utils/count.luau
luau
.luau
--[=[ Counts the number of elements in a table. @param object The table to count. @return The number of elements in the table. ]=] local function count(object: any): number local count = 0 for _ in next, object do count += 1 end return count end return count
71
littensy/charm
littensy-charm-d0b7cff/tests/utils/renderHook.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") _G.__ROACT_17_MOCK_SCHEDULER__ = true local React = require(ReplicatedStorage.DevPackages.React) local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox) type RenderedHook<Props, Result> = { result: Result, rerender: (Props?) -> (), unmo...
236
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Admin/announce.luau
luau
.luau
return { Name = "announce", Aliases = { "m" }, Description = "Makes a server-wide announcement.", Group = "DefaultAdmin", Args = { { Type = "string", Name = "text", Description = "The announcement text.", }, }, }
64
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Admin/gotoPlace.luau
luau
.luau
return { Name = "goto-place", Aliases = {}, Description = "Teleport to a Roblox place", Group = "DefaultAdmin", AutoExec = { 'alias "follow-player|Join a player in another server" goto-place $1{players|Players} ${{get-player-place-instance $2{playerId|Target}}}', 'alias "rejoin|Rejoin this place. You might end...
225
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Admin/kick.luau
luau
.luau
return { Name = "kick", Aliases = { "boot" }, Description = "Kicks a player or set of players.", Group = "DefaultAdmin", Args = { { Type = "players", Name = "players", Description = "The players to kick.", }, }, }
68
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Admin/kickServer.luau
luau
.luau
return function(_, players) for _, player in pairs(players) do player:Kick("Kicked by admin.") end return ("Kicked %d players."):format(#players) end
41
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Admin/kill.luau
luau
.luau
return { Name = "kill", Aliases = { "slay" }, Description = "Kills a player or set of players.", Group = "DefaultAdmin", Args = { { Type = "players", Name = "victims", Description = "The players to kill.", }, }, }
71
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Admin/killServer.luau
luau
.luau
return function(_, players) for _, player in pairs(players) do if player.Character then player.Character:BreakJoints() end end return ("Killed %d players."):format(#players) end
48
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Admin/teleport.luau
luau
.luau
return { Name = "teleport", Aliases = { "tp" }, Description = "Teleports a player or set of players to one target.", Group = "DefaultAdmin", AutoExec = { 'alias "bring|Brings a player or set of players to you." teleport $1{players|players|The players to bring} ${me}', 'alias "to|Teleports you to another player...
182
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Admin/teleportServer.luau
luau
.luau
return function(_, fromPlayers, destination) local cframe if typeof(destination) == "Instance" then if destination.Character and destination.Character:FindFirstChild("HumanoidRootPart") then cframe = destination.Character.HumanoidRootPart.CFrame else return "Target player has no character." end elseif t...
179
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Debug/fetch.luau
luau
.luau
return { Name = "fetch", Aliases = {}, Description = "Fetch a value from the Internet", Group = "DefaultDebug", Args = { { Type = "url", Name = "URL", Description = "The URL to fetch.", }, }, }
62
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Debug/fetchServer.luau
luau
.luau
local HttpService = game:GetService("HttpService") return function(_, url) return HttpService:GetAsync(url) end
25
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Debug/getPlayerPlaceInstance.luau
luau
.luau
return { Name = "get-player-place-instance", Aliases = {}, Description = "Returns the target player's Place ID and the JobId separated by a space. Returns 0 if the player is offline or something else goes wrong.", Group = "DefaultDebug", Args = { { Type = "playerId", Name = "Player", Description = "Get ...
171
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Debug/getPlayerPlaceInstanceServer.luau
luau
.luau
local TeleportService = game:GetService("TeleportService") return function(_, playerId, format) format = format or "PlaceIdJobId" local ok, _, errorText, placeId, jobId = pcall(function() return TeleportService:GetPlayerPlaceInstanceAsync(playerId) end) if not ok or (errorText and #errorText > 0) then if for...
187
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Debug/position.luau
luau
.luau
local Players = game:GetService("Players") return { Name = "position", Aliases = { "pos" }, Description = "Returns Vector3 position of you or other players. Empty string is the player has no character.", Group = "DefaultDebug", Args = { { Type = "player", Name = "Player", Description = "The player to r...
160
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Debug/uptime.luau
luau
.luau
return { Name = "uptime", Aliases = {}, Description = "Returns the amount of time the server has been running.", Group = "DefaultDebug", Args = {}, }
37
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Debug/uptimeServer.luau
luau
.luau
local startTime = os.time() return function() local uptime = os.time() - startTime return ("%dd %dh %dm %ds"):format( math.floor(uptime / (60 * 60 * 24)), math.floor(uptime / (60 * 60)) % 24, math.floor(uptime / 60) % 60, math.floor(uptime) % 60 ) end
92
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Debug/version.luau
luau
.luau
local version = "v1.12.0" return { Name = "version", Args = {}, Description = "Shows the current version of Cmdr", Group = "DefaultDebug", ClientRun = function() return ("Cmdr Version %s"):format(version) end, }
60
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/alias.luau
luau
.luau
return { Name = "alias", Aliases = {}, Description = "Creates a new, single command out of a command and given arguments.", Group = "DefaultUtil", Args = { { Type = "string", Name = "Alias name", Description = "The key or input type you'd like to bind the command to.", }, { Type = "string", Na...
177
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/bind.luau
luau
.luau
local UserInputService = game:GetService("UserInputService") local TextChatService = game:GetService("TextChatService") return { Name = "bind", Aliases = {}, Description = "Binds a command string to a key or mouse input.", Group = "DefaultUtil", Args = { { Type = "userInput ! bindableResource @ player", N...
543
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/clear.luau
luau
.luau
local Players = game:GetService("Players") return { Name = "clear", Aliases = {}, Description = "Clear all lines above the entry line of the Cmdr window.", Group = "DefaultUtil", Args = {}, ClientRun = function() local player = Players.LocalPlayer local gui = player:WaitForChild("PlayerGui"):WaitForChild("Cm...
148
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/convertTimestamp.luau
luau
.luau
return { Name = "convertTimestamp", Aliases = { "date" }, Description = "Convert a timestamp to a human-readable format.", Group = "DefaultUtil", Args = { { Type = "number", Name = "timestamp", Description = "A numerical representation of a specific moment in time.", Optional = true, }, }, Client...
116
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/echo.luau
luau
.luau
return { Name = "echo", Aliases = { "=" }, Description = "Echoes your text back to you.", Group = "DefaultUtil", Args = { { Type = "string", Name = "Text", Description = "The text.", }, }, ClientRun = function(_, text) return text end, }
76
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/edit.luau
luau
.luau
local Players = game:GetService("Players") local TEXT_BOX_PROPERTIES = { AnchorPoint = Vector2.new(0.5, 0.5), BackgroundColor3 = Color3.fromRGB(17, 17, 17), BackgroundTransparency = 0.05, BorderColor3 = Color3.fromRGB(17, 17, 17), BorderSizePixel = 20, ClearTextOnFocus = false, MultiLine = true, Position = UDi...
546
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/history.luau
luau
.luau
return { Name = "history", Aliases = {}, AutoExec = { 'alias "!|Displays previous command from history." run ${history $1{number|Line Number}}', 'alias "^|Runs the previous command, replacing all occurrences of A with B." run ${run replace ${history -1} $1{string|A} $2{string|B}}', 'alias "!!|Reruns the last c...
206
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/hover.luau
luau
.luau
local Players = game:GetService("Players") return { Name = "hover", Description = "Returns the name of the player you are hovering over.", Group = "DefaultUtil", Args = {}, ClientRun = function() local mouse = Players.LocalPlayer:GetMouse() local target = mouse.Target if not target then return "" end...
106
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/jsonArrayDecode.luau
luau
.luau
return { Name = "json-array-decode", Aliases = {}, Description = "Decodes a JSON Array into a comma-separated list", Group = "DefaultUtil", Args = { { Type = "json", Name = "JSON", Description = "The JSON array.", }, }, ClientRun = function(_, value) if type(value) ~= "table" then value = { va...
105
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/jsonArrayEncode.luau
luau
.luau
local HttpService = game:GetService("HttpService") return { Name = "json-array-encode", Aliases = {}, Description = "Encodes a comma-separated list into a JSON array", Group = "DefaultUtil", Args = { { Type = "string", Name = "CSV", Description = "The comma-separated list", }, }, ClientRun = funct...
101
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/len.luau
luau
.luau
return { Name = "len", Aliases = {}, Description = "Returns the length of a comma-separated list", Group = "DefaultUtil", Args = { { Type = "string", Name = "CSV", Description = "The comma-separated list", }, }, ClientRun = function(_, list) return #(list:split(",")) end, }
81
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/math.luau
luau
.luau
return { Name = "math", Aliases = {}, Description = "Perform a math operation on 2 values.", Group = "DefaultUtil", AutoExec = { 'alias "+|Perform an addition." math + $1{number|Number} $2{number|Number}', 'alias "-|Perform a subtraction." math - $1{number|Number} $2{number|Number}', 'alias "*|Perform a mult...
301
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/pick.luau
luau
.luau
return { Name = "pick", Aliases = {}, Description = "Picks a value out of a comma-separated list.", Group = "DefaultUtil", Args = { { Type = "positiveInteger", Name = "Index to pick", Description = "The index of the item you want to pick", }, { Type = "string", Name = "CSV", Description = "...
123
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/rand.luau
luau
.luau
local generator = Random.new() return { Name = "rand", Aliases = {}, Description = "Returns a random number between min and max", Group = "DefaultUtil", Args = { { Type = "integer", Name = "First number", Description = "If second number is nil, random number is between 1 and this value. If second numbe...
179
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/replace.luau
luau
.luau
return { Name = "replace", Aliases = { "gsub", "//" }, Description = "Replaces text A with text B", Group = "DefaultUtil", AutoExec = { 'alias "map|Maps a CSV into another CSV" replace $1{string|CSV} ([^,]+) "$2{string|mapped value|Use %1 to insert the element}"', 'alias "join|Joins a CSV with a specified deli...
247
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/resolve.luau
luau
.luau
return { Name = "resolve", Aliases = {}, Description = "Resolves Argument Value Operators into lists. E.g., resolve players * gives you a list of all players.", Group = "DefaultUtil", AutoExec = { 'alias "me|Displays your username" resolve players .', }, Args = { { Type = "type", Name = "Type", Desc...
201
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/run.luau
luau
.luau
return { Name = "run", Aliases = { ">" }, AutoExec = { 'alias "discard|Run a command and discard the output." replace ${run $1} .* \\"\\"', }, Description = "Runs a given command string (replacing embedded commands).", Group = "DefaultUtil", Args = { { Type = "string", Name = "Command", Description ...
129
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/runLines.luau
luau
.luau
return { Name = "run-lines", Aliases = {}, Description = "Splits input by newlines and runs each line as its own command. This is used by the init-run command.", Group = "DefaultUtil", Args = { { Type = "string", Name = "Script", Description = "The script to parse.", Default = "", }, }, ClientRu...
211
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/runif.luau
luau
.luau
local conditions = { startsWith = function(text, arg) if text:sub(1, #arg) == arg then return text:sub(#arg + 1) end end, } return { Name = "runif", Aliases = {}, Description = "Runs a given command string if a certain condition is met.", Group = "DefaultUtil", Args = { { Type = "conditionFunction",...
317
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/unbind.luau
luau
.luau
return { Name = "unbind", Aliases = {}, Description = "Unbinds an input previously bound with Bind", Group = "DefaultUtil", Args = { { Type = "userInput ! bindableResource @ player", Name = "Input/Key", Description = "The key or input type you'd like to unbind.", }, }, ClientRun = function(context,...
154
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/var.luau
luau
.luau
return { Name = "var", Aliases = {}, Description = "Gets a stored variable.", Group = "DefaultUtil", AutoExec = { 'alias "init-edit|Edit your initialization script" edit ${var init} \\\\\n && var= init ||', 'alias "init-run|Re-runs the initialization script manually." run-lines ${var init}', "init-run", }, ...
181
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/Utility/varSet.luau
luau
.luau
return { Name = "var=", Aliases = {}, Description = "Sets a stored value.", Group = "DefaultUtil", Args = { { Type = "storedKey", Name = "Key", Description = "The key to set, saved in your user data store. Keys prefixed with . are not saved. Keys prefixed with $ are game-wide. Keys prefixed with $. are ...
152
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInCommands/help.luau
luau
.luau
local ARGUMENT_SHORTHANDS = [[ Argument Shorthands ------------------- . Me/Self * All/Everyone ** Others ? Random ?N List of N random values ]] local TIPS = [[ Tips ---- • Utilize the Tab key to automatically complete commands • Easily select and copy command output ]] return { Name = "help", Aliases = { "...
563
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/BindableResource.luau
luau
.luau
return function(registry) registry:RegisterType("bindableResource", registry.Cmdr.Util.MakeEnumType("BindableResource", { "Chat" })) end
32
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/BrickColor.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local brickColorNames = { "White", "Grey", "Light yellow", "Brick yellow", "Light green (Mint)", "Light reddish violet", "Pastel Blue", "Light orange brown", "Nougat", "Bright red", "Med. reddish violet", "Bright blue", "Bright yellow", "Earth orange...
1,478
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/Color3.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local color3Type = Util.MakeSequenceType({ Prefixes = "# hexColor3 ! brickColor3", ValidateEach = function(value, i) if value == nil then return false, ("Invalid or missing number at position %d in Color3 type."):format(i) elseif value < 0 or value > 255 ...
409
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/Command.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) return function(cmdr) local commandType = { Transform = function(text) local findCommand = Util.MakeFuzzyFinder(cmdr:GetCommandNames()) return findCommand(text) end, Validate = function(commands) return #commands > 0, "No command with that name c...
139
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/ConditionFunction.luau
luau
.luau
return function(registry) registry:RegisterType("conditionFunction", registry.Cmdr.Util.MakeEnumType("ConditionFunction", { "startsWith" })) end
31
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/Duration.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local unitTable = { Years = 31556926, Months = 2629744, Weeks = 604800, Days = 86400, Hours = 3600, Minutes = 60, Seconds = 1, } local searchKeyTable = {} for key, _ in pairs(unitTable) do table.insert(searchKeyTable, key) end local unitFinder = Util.Make...
983
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/JSON.luau
luau
.luau
local HttpService = game:GetService("HttpService") return function(registry) registry:RegisterType("json", { Validate = function(text) return pcall(HttpService.JSONDecode, HttpService, text) end, Parse = function(text) return HttpService:JSONDecode(text) end, }) end
71
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/MathOperator.luau
luau
.luau
return function(registry) registry:RegisterType( "mathOperator", registry.Cmdr.Util.MakeEnumType("Math Operator", { { Name = "+", Perform = function(a, b) return a + b end, }, { Name = "-", Perform = function(a, b) return a - b end, }, { Name = "*", Perform ...
210
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/Player.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local Players = game:GetService("Players") local playerType = { Transform = function(text) local findPlayer = Util.MakeFuzzyFinder(Players:GetPlayers()) return findPlayer(text) end, Validate = function(players) return #players > 0, "No player with that ...
202
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/PlayerId.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local Players = game:GetService("Players") local nameCache = {} local function getUserId(name) if nameCache[name] then return nameCache[name] elseif Players:FindFirstChild(name) then nameCache[name] = Players[name].UserId return Players[name].UserId else ...
326
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/Primitives.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local stringType = { Validate = function(value) return value ~= nil end, Parse = function(value) return tostring(value) end, } local numberType = { Transform = function(text) return tonumber(text) end, Validate = function(value) return value ~= n...
814
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/StoredKey.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local VALID_STORED_KEY_NAME_PATTERNS = { "^%a[%w_]*$", "^%$%a[%w_]*$", "^%.%a[%w_]*$", "^%$%.%a[%w_]*$", } return function(registry) local storedKeyType = { Autocomplete = function(text) local find = registry.Cmdr.Util.MakeFuzzyFinder( registry.Cmdr...
246
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/Team.luau
luau
.luau
local Teams = game:GetService("Teams") local Util = require(script.Parent.Parent.Shared.Util) local teamType = { Transform = function(text) local findTeam = Util.MakeFuzzyFinder(Teams:GetTeams()) return findTeam(text) end, Validate = function(teams) return #teams > 0, "No team with that name could be found....
288
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/Type.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) return function(cmdr) local typeType = { Transform = function(text) local findCommand = Util.MakeFuzzyFinder(cmdr:GetTypeNames()) return findCommand(text) end, Validate = function(commands) return #commands > 0, "No type with that name could be f...
139
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/URL.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local storedKeyType = { Validate = function(text) if text:match("^https?://.+$") then return true end return false, "URLs must begin with http:// or https://" end, Parse = function(text) return text end, } return function(cmdr) cmdr:RegisterType...
106
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/UserInput.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local combinedInputEnums = Enum.UserInputType:GetEnumItems() for _, e in pairs(Enum.KeyCode:GetEnumItems()) do combinedInputEnums[#combinedInputEnums + 1] = e end local userInputType = { Transform = function(text) local findEnum = Util.MakeFuzzyFinder(combin...
172
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/BuiltInTypes/Vector.luau
luau
.luau
local Util = require(script.Parent.Parent.Shared.Util) local function validateVector(value, i) if value == nil then return false, ("Invalid or missing number at position %d in Vector type."):format(i) end return true end local vector3Type = Util.MakeSequenceType({ ValidateEach = validateVector, TransformEach ...
191
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/CmdrClient/CmdrInterface/AutoComplete.luau
luau
.luau
local Players = game:GetService("Players") local Player = Players.LocalPlayer return function(Cmdr) local AutoComplete = { Items = {}, ItemOptions = {}, SelectedItem = 0, } local Util = Cmdr.Util local Gui = Player:WaitForChild("PlayerGui"):WaitForChild("Cmdr"):WaitForChild("Autocomplete") local AutoItem ...
1,762
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/CmdrClient/CmdrInterface/Window.luau
luau
.luau
-- Here be dragons local GuiService = game:GetService("GuiService") local UserInputService = game:GetService("UserInputService") local TextChatService = game:GetService("TextChatService") local Players = game:GetService("Players") local Player = Players.LocalPlayer local WINDOW_MAX_HEIGHT = 300 local MOUSE_TOUCH_ENUM ...
2,381
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/CmdrClient/CmdrInterface/init.luau
luau
.luau
-- Here be dragons local Players = game:GetService("Players") local Player = Players.LocalPlayer return function(Cmdr) local Util = Cmdr.Util local Window = require(script:WaitForChild("Window")) Window.Cmdr = Cmdr local AutoComplete = require(script:WaitForChild("AutoComplete"))(Cmdr) Window.AutoComplete = Au...
1,147
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/CmdrClient/DefaultEventHandlers.luau
luau
.luau
local StarterGui = game:GetService("StarterGui") local TextChatService = game:GetService("TextChatService") local Window = require(script.Parent.CmdrInterface.Window) return function(Cmdr) Cmdr:HandleEvent("Message", function(text) if TextChatService.ChatVersion == Enum.ChatVersion.LegacyChatService then Starter...
192
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/CmdrClient/init.luau
luau
.luau
local RunService = game:GetService("RunService") local StarterGui = game:GetService("StarterGui") local Players = game:GetService("Players") local Player = Players.LocalPlayer local Shared = script:WaitForChild("Shared") local Util = require(Shared:WaitForChild("Util")) if RunService:IsClient() == false then error( ...
1,430
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/CreateGui.luau
luau
.luau
return function() local Cmdr = Instance.new("ScreenGui") Cmdr.DisplayOrder = 1000 Cmdr.Name = "Cmdr" Cmdr.ResetOnSpawn = false Cmdr.AutoLocalize = false local Frame = Instance.new("ScrollingFrame") Frame.BackgroundColor3 = Color3.fromRGB(17, 17, 17) Frame.BackgroundTransparency = 0.4 Frame.BorderSizePixel = 0...
2,201
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/Initialize.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local StarterGui = game:GetService("StarterGui") local CreateGui = require(script.Parent.CreateGui) -- Handles initial preparation of the game server-side. return function(cmdr) local ReplicatedRoot, RemoteFunction, RemoteEvent local function Create(cla...
254
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/Shared/Registry.luau
luau
.luau
local RunService = game:GetService("RunService") local Util = require(script.Parent.Util) --[=[ @class Registry The registry keeps track of all the commands and types that Cmdr knows about. ]=] --[=[ @type HookType "BeforeRun" | "AfterRun" @within Registry ]=] --[=[ @interface ArgumentDefinition @within Regi...
4,860
evaera/Cmdr
evaera-Cmdr-030e1a6/Cmdr/init.luau
luau
.luau
local RunService = game:GetService("RunService") local Util = require(script.Shared:WaitForChild("Util")) if RunService:IsServer() == false then error( "[Cmdr] Client scripts cannot require the server library. Please require the client library from the client to use Cmdr in your own code." ) end --[=[ @class Cmd...
389
centau/vide
centau-vide-7deae9c/init.luau
luau
.luau
local vide = require "@self/src/lib" export type source<T> = vide.source<T> export type Source<T> = vide.Source<T> export type context<T> = vide.context<T> export type Context<T> = vide.Context<T> return vide
52
centau/vide
centau-vide-7deae9c/src/apply.luau
luau
.luau
local typeof = game and typeof or require "../test/mock".typeof :: never local flags = require "./flags" local implicit_effect = require "./implicit_effect" local _, is_action = require "./action"() local graph = require "./graph" type Node<T> = graph.Node<T> type Array<V> = { V } type ArrayOrV<V> = {ArrayOrV<V>} | V...
1,226
centau/vide
centau-vide-7deae9c/src/batch.luau
luau
.luau
local flags = require "./flags" local graph = require "./graph" local function batch(setter: () -> ()) local already_batching = flags.batch local from if not already_batching then flags.batch = true from = graph.get_update_queue_length() end local ok, err: string? = xpcall(setter,...
131
centau/vide
centau-vide-7deae9c/src/branch.luau
luau
.luau
local graph = require "./graph" type Node<T> = graph.Node<T> local create_node = graph.create_node local push_scope = graph.push_scope local pop_scope = graph.pop_scope local destroy = graph.destroy local get_scope = graph.get_scope local function branch<T>(fn: () -> T): (() -> (), T) local current = get_scope() ...
223
centau/vide
centau-vide-7deae9c/src/changed.luau
luau
.luau
local action = require "./action"() local cleanup = require "./cleanup" local function changed<T>(property: string, callback: (T) -> ()) return action(function(instance) local con = instance:GetPropertyChangedSignal(property):Connect(function() callback((instance :: any)[property]) end)...
91
centau/vide
centau-vide-7deae9c/src/cleanup.luau
luau
.luau
local typeof = game and typeof or require "../test/mock".typeof :: never local graph = require "./graph" local get_scope = graph.get_scope local push_cleanup = graph.push_cleanup local function helper(obj: any) return if typeof(obj) == "RBXScriptConnection" then function() obj:Disconnect() end els...
365
centau/vide
centau-vide-7deae9c/src/context.luau
luau
.luau
local graph = require "./graph" type Node<T> = graph.Node<T> local create_node = graph.create_node local get_scope = graph.get_scope local push_scope = graph.push_scope local pop_scope = graph.pop_scope local set_context = graph.set_context export type Context<T> = (() -> T) & (<U>(T, () -> U) -> U) local nil_symbol ...
456
centau/vide
centau-vide-7deae9c/src/create.luau
luau
.luau
local typeof = game and typeof or require "../test/mock".typeof :: never local Instance = game and Instance or require "../test/mock".Instance :: never local defaults = require "./defaults" local apply = require "./apply" local flags = require "./flags" local ctor_cache = {} :: { [string]: (AnyProps) -> Instance } lo...
785
centau/vide
centau-vide-7deae9c/src/defaults.luau
luau
.luau
local Enum = game and Enum or require "../test/mock".Enum :: never local Color3 = game and Color3 or require "../test/mock".Color3 :: never return { Part = { Material = Enum.Material.SmoothPlastic, Size = vector.create(1, 1, 1), Anchored = true }, BillboardGui = { ResetOnSp...
831
centau/vide
centau-vide-7deae9c/src/derive.luau
luau
.luau
local graph = require "./graph" local create_node = graph.create_node local push_scope_as_child_of = graph.push_scope_as_child_of local assert_stable_scope = graph.assert_stable_scope local evaluate_node = graph.evaluate_node local function derive<T>(source: () -> T): () -> T local node = create_node(assert_stable...
111
centau/vide
centau-vide-7deae9c/src/effect.luau
luau
.luau
local graph = require "./graph" local create_node = graph.create_node local assert_stable_scope = graph.assert_stable_scope local evaluate_node = graph.evaluate_node local function effect<T>(callback: (T) -> T, initial_value: T) local node = create_node(assert_stable_scope(), callback, initial_value) evaluate...
106
centau/vide
centau-vide-7deae9c/src/flags.luau
luau
.luau
local function inline_test(): string return debug.info(1, "n") end local is_O2 = inline_test() ~= "inline_test" return { strict = not is_O2, defaults = true, defer_nested_properties = true, batch = false, }
60
centau/vide
centau-vide-7deae9c/src/graph.luau
luau
.luau
local flags = require "./flags" export type SourceNode<T> = { cache: T, [number]: Node<T> } export type Node<T> = { cache: T, effect: ((T) -> T) | false, cleanups: { () -> () } | false, context: { [number]: unknown } | false, owned: { Node<T> } | false, owner: Node<T> | false, ...
2,028
centau/vide
centau-vide-7deae9c/src/implicit_effect.luau
luau
.luau
local graph = require "./graph" type Node<T> = graph.Node<T> local create_node = graph.create_node local assert_stable_scope = graph.assert_stable_scope local get_scope = graph.get_scope local evaluate_node = graph.evaluate_node local push_cleanup = graph.push_cleanup local function update_property_effect(p: { ins...
794
centau/vide
centau-vide-7deae9c/src/indexes.luau
luau
.luau
local flags = require "./flags" local branch = require "./branch" local source = require "./source" local effect = require "./effect" local timeout = require "./timeout" () type Array<T> = { T } type Map<K, V> = { [K]: V } type Source<T> = () -> T local function indexes<K, V, Obj>( input: Source<Map<K, V>>, c...
690
centau/vide
centau-vide-7deae9c/src/init.luau
luau
.luau
assert(game, "when using vide outside of Roblox, require lib.luau instead") local vide = require(script.lib) export type source<T> = vide.source<T> export type Source<T> = vide.Source<T> export type context<T> = vide.context<T> export type Context<T> = vide.Context<T> return vide
68
centau/vide
centau-vide-7deae9c/src/lib.luau
luau
.luau
local version = { major = 0, minor = 4, patch = 0 } local root = require "./root" local branch = require "./branch" local mount = require "./mount" local create = require "./create" local apply = require "./apply" local source = require "./source" local effect = require "./effect" local derive = require "./derive" loc...
715
centau/vide
centau-vide-7deae9c/src/mount.luau
luau
.luau
local root = require "./root" local apply = require "./apply" local function mount<T>(component: () -> T, target: Instance?): () -> () return root(function() local result = component() if target then apply(target, { result }) end end) end return mount :: (<T>(component: () -> T, target: Instan...
91