repo stringclasses 341
values | file_path stringlengths 29 173 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.66M | tokens int64 2 598k |
|---|---|---|---|---|---|
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/exit.luau | luau | .luau | return {
Name = "exit",
Aliases = { "escape" },
Description = "Exits the Cmdr window.",
Group = "DefaultUtil",
Args = {},
ClientRun = function(context: any): string
context.Cmdr:Hide()
return ""
end,
}
| 59 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/history.luau | luau | .luau | return {
Name = "history",
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 command." ! -1',... | 208 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/hover.luau | luau | .luau | const Players = game:GetService("Players")
const Player = Players.LocalPlayer
return {
Name = "hover",
Description = "Returns the name of the player you are hovering over.",
Group = "DefaultUtil",
Args = {},
ClientRun = function(): string
const mouse = Player:GetMouse()
const target = mouse.Target
if not ... | 126 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/jsonArrayDecode.luau | luau | .luau | return {
Name = "json-array-decode",
Description = "Decodes a JSON Array into a comma-separated list.",
Group = "DefaultUtil",
Args = {
{
Type = "json",
Name = "JSON",
Description = "The JSON array.",
},
},
ClientRun = function(_, value: any): string
if type(value) ~= "table" then
return tostri... | 134 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/jsonArrayEncode.luau | luau | .luau | const HttpService = game:GetService("HttpService")
return {
Name = "json-array-encode",
Description = "Encodes a comma-separated list into a JSON array.",
Group = "DefaultUtil",
Args = {
{
Type = "string",
Name = "CSV",
Description = "The comma-separated list.",
},
},
ClientRun = function(_, text: ... | 101 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/len.luau | luau | .luau | return {
Name = "len",
Description = "Returns the length of a comma-separated list.",
Group = "DefaultUtil",
Args = {
{
Type = "string",
Name = "CSV",
Description = "The comma-separated list.",
},
},
ClientRun = function(_, list: string): string
return if #list == 0 then "0" else tostring(#(list:s... | 94 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/math.luau | luau | .luau | type MathOperation = { Name: string, Perform: (a: number, b: number) -> number }
return {
Name = "math",
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... | 330 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/pick.luau | luau | .luau | return {
Name = "pick",
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 = "The comma-sepa... | 125 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/rand.luau | luau | .luau | const GENERATOR = Random.new()
return {
Name = "rand",
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 number is provided,... | 209 |
evaera/Cmdr | evaera-Cmdr-f565794/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 d... | 256 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/resolve.luau | luau | .luau | return {
Name = "resolve",
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",
Description = "The... | 213 |
evaera/Cmdr | evaera-Cmdr-f565794/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 ... | 135 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/runLines.luau | luau | .luau | return {
Name = "run-lines",
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 = "",
},
},
ClientRun = function(co... | 215 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/runif.luau | luau | .luau | type ConditionFn = (text: string, arg: string) -> string?
const CONDITIONS: { [string]: ConditionFn } = {
startsWith = function(text, arg)
return text:sub(1, #arg) == arg and text:sub(#arg + 1)
end,
contains = function(text, arg)
return text:find(arg, 1, true) and text
end,
endsWith = function(text, arg)
... | 605 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/unbind.luau | luau | .luau | return {
Name = "unbind",
Description = "Unbinds an input previously bound with Bind.",
Group = "DefaultUtil",
Args = {
{
Type = "userInput @ player",
Name = "Input/Key",
Description = "The key or input type you'd like to unbind.",
},
},
ClientRun = function(context: any, bind: Enum.UserInputType | ... | 179 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/var.luau | luau | .luau | return {
Name = "var",
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",
},
Args = {
{
... | 181 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/Utility/varSet.luau | luau | .luau | return {
Name = "var=",
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 game-wide and n... | 152 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInCommands/help.luau | luau | .luau | const COMMAND_COLOR = Color3.fromRGB(230, 126, 34)
const TEXT_COLOR = Color3.fromRGB(230, 230, 230)
const ARGUMENT_SHORTHANDS = [[
Argument Shorthands
-------------------
. Me/Self
* All/Everyone
** Others
? Random
?N List of N random values
]]
const TIPS = [[
Tips
----
• Use the Tab key to autocomplete comma... | 596 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/BrickColor.luau | luau | .luau | const BRICK_COLOR_NAMES = {
"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",
"Black",
"Dark grey",
"Dark green",
"Medium gre... | 1,561 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/Color3.luau | luau | .luau | const function parseHexDigit(x: string?): number?
if not x then
return nil
end
if #x == 1 then
x = `{x}{x}`
end
return tonumber(x, 16)
end
return function(registry: any)
const color3Type = registry.Cmdr.Util.MakeSequenceType({
Prefixes = "# hexColor3 ! brickColor3",
ValidateEach = function(value: numbe... | 494 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/Command.luau | luau | .luau | return function(registry: any)
const commandType = {
Transform = function(text: string): { [number]: string }
const findCommand = registry.Cmdr.Util.MakeFuzzyFinder(registry:GetCommandNames())
return findCommand(text)
end,
Validate = function(commands: { [number]: string }): (boolean, string?)
return #... | 176 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/Duration.luau | luau | .luau | const UNIT_SECONDS: { [string]: number } = {
Years = 31556926,
Months = 2629744,
Weeks = 604800,
Days = 86400,
Hours = 3600,
Minutes = 60,
Seconds = 1,
}
const unitNames: { string } = {}
for unitName: string in pairs(UNIT_SECONDS) do
unitNames[#unitNames + 1] = unitName
end
const function mapUnits(units: { st... | 816 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/JSON.luau | luau | .luau | const HttpService = game:GetService("HttpService")
return function(registry: any)
registry:RegisterType("json", {
Validate = function(text: string): boolean
return pcall(HttpService.JSONDecode, HttpService, text)
end,
Parse = function(text: string): { [string]: any } | any
return HttpService:JSONDecode(t... | 88 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/MathOperator.luau | luau | .luau | return function(registry: any)
registry:RegisterType(
"mathOperator",
registry.Cmdr.Util.MakeEnumType("Math Operator", {
{
Name = "+",
Perform = function(a: number, b: number): number
return a + b
end,
},
{
Name = "-",
Perform = function(a: number, b: number): number
return a... | 248 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/Player.luau | luau | .luau | const Players = game:GetService("Players")
return function(registry: any)
const playerType = {
Transform = function(text: string): { Player }
const findPlayer = registry.Cmdr.Util.MakeFuzzyFinder(Players:GetPlayers())
return findPlayer(text)
end,
Validate = function(players: { Player }): (boolean, string... | 233 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/PlayerId.luau | luau | .luau | const Players = game:GetService("Players")
const nameCache: { [string]: number } = {}
const function getUserId(username: string): number?
username = username:match("%(@([^%)]+)%)") or username
if nameCache[username] then
return nameCache[username]
elseif Players:FindFirstChild(username) then
const player = Pl... | 405 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/Primitives.luau | luau | .luau | const TRUTHY_VALUES = { "true", "t", "yes", "y", "on", "enable", "enabled", "1", "+" }
const FALSY_VALUES = { "false", "f", "no", "n", "off", "disable", "disabled", "0", "-" }
type NumberTransformer = {
Transform: (text: string) -> number?,
Validate: (value: number?) -> (boolean, string?),
Parse: (value: number) ->... | 1,038 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/StoredKey.luau | luau | .luau | const VALID_STORED_KEY_NAME_PATTERNS: { string } = {
"^%a[%w_]*$",
"^%$%a[%w_]*$",
"^%.%a[%w_]*$",
"^%$%.%a[%w_]*$",
}
return function(registry: any)
const storedKeyType = {
Autocomplete = function(text: string): { string }
const store = registry:GetStore("vars_used") or {}
const find = registry.Cmdr.Util... | 263 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/Team.luau | luau | .luau | const Teams = game:GetService("Teams")
return function(registry: any)
const teamType = {
Transform = function(text: string): { Team }
const findTeam = registry.Cmdr.Util.MakeFuzzyFinder(Teams:GetTeams())
return findTeam(text)
end,
Validate = function(teams: { Team }): (boolean, string?)
return #teams ... | 350 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/Type.luau | luau | .luau | return function(registry: any)
const typeType = {
Transform = function(text: string): { string }
const findType = registry.Cmdr.Util.MakeFuzzyFinder(registry:GetTypeNames())
return findType(text)
end,
Validate = function(types: { string }): (boolean, string?)
return #types > 0, "No type with that name ... | 161 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/URL.luau | luau | .luau | return function(registry: any)
const urlType = {
Validate = function(text: string): (boolean, string?)
if text:match("^https?://.+$") then
return true
end
return false, "URLs must begin with http:// or https://"
end,
Parse = function(text: string): string
return text
end,
}
registry:Regist... | 116 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/BuiltInTypes/UserInput.luau | luau | .luau | const combinedInputEnums: { EnumItem } = {}
for _, enum: Enum.UserInputType in ipairs(Enum.UserInputType:GetEnumItems()) do
combinedInputEnums[#combinedInputEnums + 1] = enum
end
for _, enum: Enum.KeyCode in ipairs(Enum.KeyCode:GetEnumItems()) do
combinedInputEnums[#combinedInputEnums + 1] = enum
end
return functio... | 249 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/CmdrClient/CmdrInterface/AutoComplete.luau | luau | .luau | const VALID_TEXT_COLOR = Color3.fromRGB(255, 255, 255)
const INVALID_TEXT_COLOR = Color3.fromRGB(255, 73, 73)
const TEXT_MEASUREMENT_SIZE = Vector2.new(1000, 1000)
--[=[
@class AutoComplete
@ignore
Handles the Cmdr suggestions interface.
]=]
return function(CmdrClient)
const autoCompleteFrame = CmdrClient.Gui:Wai... | 1,809 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/CmdrClient/CmdrInterface/CreateGui.luau | luau | .luau | const Players = game:GetService("Players")
const StarterGui = game:GetService("StarterGui")
const Player = Players.LocalPlayer
const PlayerGui = Player:WaitForChild("PlayerGui")
return function(): ScreenGui
if StarterGui:FindFirstChild("Cmdr") then
return PlayerGui:WaitForChild("Cmdr")
end
const Cmdr = Instance... | 2,216 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/CmdrClient/CmdrInterface/Window.luau | luau | .luau | const GuiService = game:GetService("GuiService")
const Players = game:GetService("Players")
const TextChatService = game:GetService("TextChatService")
const UserInputService = game:GetService("UserInputService")
const WINDOW_MAX_HEIGHT = 300
const MOUSE_TOUCH_INPUTS =
{ Enum.UserInputType.MouseButton1, Enum.UserInput... | 4,687 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/CmdrClient/CmdrInterface/init.luau | luau | .luau | const CreateGui = require("@self/CreateGui")
const WindowModule = require("@self/Window")
const AutoCompleteModule = require("@self/AutoComplete")
return function(CmdrClient)
CmdrClient.Gui = CreateGui()
const AutoComplete = AutoCompleteModule(CmdrClient)
const Window = WindowModule(CmdrClient, AutoComplete)
Win... | 107 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/CmdrClient/DefaultEventHandlers.luau | luau | .luau | const TextChatService = game:GetService("TextChatService")
const TEXT_CHANNELS = TextChatService:WaitForChild("TextChannels")
const RBXSYSTEM_CHANNEL: TextChannel = TEXT_CHANNELS:WaitForChild("RBXSystem")
return function(CmdrClient)
CmdrClient:HandleEvent("Message", function(text: string)
RBXSYSTEM_CHANNEL:Display... | 167 |
evaera/Cmdr | evaera-Cmdr-f565794/Cmdr/CmdrClient/Shared/Registry.luau | luau | .luau | const RunService = game:GetService("RunService")
const Util = require("./Util")
const IS_SERVER = RunService:IsServer()
const IS_CLIENT = RunService:IsClient()
const TYPE_METHODS = Util.MakeDictionary({
"Transform",
"Validate",
"Autocomplete",
"Parse",
"DisplayName",
"Listable",
"ValidateOnce",
"Prefixes",
... | 5,798 |
centau/vide | centau-vide-f3bfc65/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>
export type Instances = vide.Instances
export type Properties<T> = vide.Properties<T>
return vide
| 70 |
centau/vide | centau-vide-f3bfc65/src/action.luau | luau | .luau | type Action = {
priority: number,
callback: (Instance) -> ()
}
local ActionMT = table.freeze {}
local function is_action(v: any)
return getmetatable(v) == ActionMT
end
local function action(callback: (Instance) -> (), priority: number?): Action
local a = {
priority = priority or 1,
ca... | 111 |
centau/vide | centau-vide-f3bfc65/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-f3bfc65/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-f3bfc65/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-f3bfc65/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-f3bfc65/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-f3bfc65/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-f3bfc65/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 function create_constructor_for_class(class: string): ({ [... | 878 |
centau/vide | centau-vide-f3bfc65/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... | 843 |
centau/vide | centau-vide-f3bfc65/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-f3bfc65/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-f3bfc65/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-f3bfc65/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-f3bfc65/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-f3bfc65/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-f3bfc65/src/init.luau | luau | .luau | assert(game, "when using vide outside of Roblox, require lib.luau instead")
local vide = require("@self/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>
export type Instances = vide.Instances
export ty... | 87 |
centau/vide | centau-vide-f3bfc65/src/lib.luau | luau | .luau | local version = { major = 0, minor = 4, patch = 1 }
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... | 733 |
centau/vide | centau-vide-f3bfc65/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 |
centau/vide | centau-vide-f3bfc65/src/read.luau | luau | .luau | local function read<T>(value: T | () -> T): T
return if type(value) == "function" then value() else value
end
return read
| 36 |
centau/vide | centau-vide-f3bfc65/src/root.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 refs = {}
local function root<T...>(fn: (destroy: () -> ()) -> T...): (() -> (), T...)
local node = create_no... | 232 |
centau/vide | centau-vide-f3bfc65/src/show.luau | luau | .luau | local source = require "./source"
local derive = require "./derive"
local effect = require "./effect"
local untrack = require "./untrack"
local switch = require "./switch"
type Array<T> = { T }
type Source<T> = () -> T
local function show<T, Obj>(
input: Source<T?>,
component: (Source<T>, Source<boolean>) -> ... | 207 |
centau/vide | centau-vide-f3bfc65/src/source.luau | luau | .luau | local graph = require "./graph"
type Node<T> = graph.Node<T>
local create_source_node = graph.create_source_node
local push_scope_as_child_of = graph.push_scope_as_child_of
local update_descendants = graph.update_descendants
export type Source<T> = (() -> T) & ((value: T) -> T)
local function source<T>(initial_value:... | 221 |
centau/vide | centau-vide-f3bfc65/src/switch.luau | luau | .luau | 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
type Component<T> = (Source<boolean>) -> (T, ...number)
local function switch_map<K, Obj>(
input: ... | 624 |
centau/vide | centau-vide-f3bfc65/src/timeout.luau | luau | .luau | local queue = {} :: {
{ t: number, fn: () -> (), cancel: boolean }
}
local function timeout(t: number, fn: () -> ())
local handle = { t = t, fn = fn, cancel = false }
table.insert(queue, handle)
return handle
end
local function update_timeouts(dt: number)
for i = #queue, 1, -1 do
local han... | 162 |
centau/vide | centau-vide-f3bfc65/src/untrack.luau | luau | .luau | local graph = require "./graph"
type Node<T> = graph.Node<T>
local get_scope = graph.get_scope
local function untrack<T>(source: () -> T): T
local scope = get_scope()
if scope then
-- sources are only tracked if the node in scope has an effect
local effect = scope.effect
scope.effe... | 162 |
centau/vide | centau-vide-f3bfc65/src/values.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 values<K, V, Obj>(
input: Source<Map<K, V>>,
co... | 754 |
littensy/charm | littensy-charm-b05f3a9/.lute/build.luau | luau | .luau | local fs = require("@std/fs")
local process = require("@lute/process")
fs.createDirectory("build")
process.run({ "rojo", "build", "--output=build/charm.rbxm", "build.project.json" }, { stdio = "inherit" })
| 57 |
littensy/charm | littensy-charm-b05f3a9/.lute/check.luau | luau | .luau | local fs = require("@std/fs")
local net = require("@std/net")
local process = require("@lute/process")
process.run({ "rojo", "sourcemap", "--output=sourcemap.json" }, { stdio = "inherit" })
fs.writeStringToFile(
"roblox.d.luau",
net.request("https://luau-lsp.pages.dev/globalTypes.None.d.luau", { method = "GET" }).b... | 278 |
littensy/charm | littensy-charm-b05f3a9/.lute/test.luau | luau | .luau | (require)("../tests/run.server")
| 7 |
littensy/charm | littensy-charm-b05f3a9/benches/bench.luau | luau | .luau | local profiles: { [string]: number } = {}
local times: { [string]: number } = {}
local stack: { string } = {}
local function run(name: string, test: () -> ())
local start = os.clock()
local iter = 0
table.clear(profiles)
table.clear(times)
table.clear(stack)
while os.clock() - start < 2 do
iter += 1
test()... | 283 |
littensy/charm | littensy-charm-b05f3a9/benches/mapped.luau | luau | .luau | local Charm = require("../packages/charm/src")
local bench = require("./bench")
local computed = Charm.computed
local mapped = Charm.mapped
local signal = Charm.signal
type Key = number
type Value = number
local count = 512
local initialState: { [Key]: Value } = table.create(count, 0)
local function expensiveOperat... | 488 |
littensy/charm | littensy-charm-b05f3a9/benches/multi.luau | luau | .luau | local Charm = require("../packages/charm/src")
local bench = require("./bench")
type Atom<T> = Charm.Atom<T>
local signal = Charm.atom
local computed = Charm.computed
local effect = Charm.effect
local function busy(): number
local a = 0
for i = 1, 100 do
a += 1
end
return a
end
do
local head = signal(0)
loc... | 999 |
littensy/charm | littensy-charm-b05f3a9/benches/propagate.luau | luau | .luau | local Charm = require("../packages/charm/src")
local bench = require("./bench")
local computed = Charm.computed
local effect = Charm.effect
local listen = Charm.listen
local signal = Charm.signal
for _, w in { 10, 100 } do
for _, h in { 10, 100 } do
bench.run(`propagate {w}*{h}`, function()
local src, setSrc = ... | 310 |
littensy/charm | littensy-charm-b05f3a9/benches/reactive.luau | luau | .luau | local Charm = require("../packages/charm/src")
local DeepCharm = require("../packages/deep-charm/src")
local bench = require("./bench")
local effect = Charm.effect
local reactive = DeepCharm.reactive
do
local value = reactive({ a = 1 })
bench.run("track reactive property", function()
effect(function()
local _ ... | 473 |
littensy/charm | littensy-charm-b05f3a9/packages/charm-sync/Charm.luau | luau | .luau | if not script then
return require("../charm/src")
end
local Charm = require(script.Parent.Parent.charm.src)
export type Atom<T> = Charm.Atom<T>
return Charm
| 38 |
littensy/charm | littensy-charm-b05f3a9/packages/charm-sync/src/config.luau | luau | .luau | return {
--[[
The interval at which to send patches to the client, in seconds.
Defaults to `0` (patches are sent up to once per frame). Set to a
negative value to disable automatic syncing.
]]
interval = 0,
--[[
Whether the history of state changes since the client's last update
should be preserved. This ... | 288 |
littensy/charm | littensy-charm-b05f3a9/packages/charm-sync/src/init.luau | luau | .luau | local client = require("@self/client")
local config = require("@self/config")
local patch = require("@self/patch")
local server = require("@self/server")
local types = require("@self/types")
local utils = require("@self/utils")
export type None = types.None
export type SyncPayload = types.SyncPayload
return {
config... | 108 |
littensy/charm | littensy-charm-b05f3a9/packages/charm-sync/src/patch.luau | luau | .luau | local Charm = require("../Charm")
local config = require("./config")
local types = require("./types")
local validate = require("./validate")
local flags = Charm.flags
export type None = types.None
local None: None = { __none = "__none" }
--[[
Checks whether a value is `None`. If `true`, the value is scheduled to b... | 934 |
littensy/charm | littensy-charm-b05f3a9/packages/charm-sync/src/server.luau | luau | .luau | local Charm = require("../Charm")
local config = require("./config")
local patch = require("./patch")
local types = require("./types")
local utils = require("./utils")
type SyncPayload = types.SyncPayload
type SyncStatus = number
type ClientKeys = { [string]: SyncStatus }
type TrackedState<T = any> = {
identifier:... | 2,565 |
littensy/charm | littensy-charm-b05f3a9/packages/charm-sync/src/types.luau | luau | .luau | --[[
A payload that can be sent from the server to the client to synchronize
the states of the client's atoms with the server.
]]
export type SyncPayload =
| {
type: "init",
data: { [string]: any },
}
| {
type: "patch",
data: { [string]: any },
}
--[[
A special type that represents a removed value in a ... | 183 |
littensy/charm | littensy-charm-b05f3a9/packages/charm-sync/src/utils.luau | luau | .luau | local Charm = require("../Charm")
type Atom<T> = Charm.Atom<T>
--[[
Flattens a nested table into a single table with slash-separated keys.
Useful for recursively collecting atoms returned by modules.
@param input A nested table.
@return A flattened table with slash-separated keys.
]]
local function flatten<Flatt... | 443 |
littensy/charm | littensy-charm-b05f3a9/packages/charm-sync/src/validate.luau | luau | .luau | local function isTableUnsafe(object: { [any]: any })
local firstKey = next(object)
if firstKey == nil then
return false
end
local keyType = type(firstKey)
local maxKey = 0
-- Keys must all be the same type
for key in object do
if type(key) ~= keyType then
return true
elseif type(key) == "number" and ... | 320 |
littensy/charm | littensy-charm-b05f3a9/packages/deep-charm/Charm.luau | luau | .luau | if not script then
return require("../charm/src")
end
return require(script.Parent.Parent.charm.src)
| 22 |
littensy/charm | littensy-charm-b05f3a9/packages/react-charm/Charm.luau | luau | .luau | return require(script.Parent.Parent.charm.src)
| 9 |
littensy/charm | littensy-charm-b05f3a9/packages/react-charm/React.luau | luau | .luau | return require(script.Parent.Parent.Parent:WaitForChild("@rbxts-js").React)
| 18 |
littensy/charm | littensy-charm-b05f3a9/packages/react-charm/ReactRoblox.luau | luau | .luau | return require(script.Parent.Parent.Parent:WaitForChild("@rbxts-js").ReactRoblox)
| 20 |
littensy/charm | littensy-charm-b05f3a9/packages/react-charm/src/init.luau | luau | .luau | local Charm = require("./Charm")
local React = require("./React")
--[[
Returns a React state that updates when the getter function updates.
Re-renders the component when the value changes.
If the `dependencies` array is provided, a new effect is created for the
current `getter` when the dependencies change. Other... | 386 |
littensy/charm | littensy-charm-b05f3a9/packages/vide-charm/Vide.luau | luau | .luau | return require(script.Parent.Parent.vide.src)
| 9 |
littensy/charm | littensy-charm-b05f3a9/packages/vide-charm/src/init.luau | luau | .luau | local Charm = require("./Charm")
local Vide = require("./Vide")
--[[
Returns a reactive source that subscribes to the current value of the given
signal or getter function.
@param getter The getter function to subscribe to.
@return The reactive source.
]]
local function useSignalState<State>(getter: () -> State): ... | 123 |
littensy/charm | littensy-charm-b05f3a9/tests/run.server.luau | luau | .luau | local Charm = require("../packages/charm/src")
local test = require("./test")
Charm.flags.strict = true
Charm.flags.frozen = true
local describeInRoblox = test.describeIf(function()
return not not game
end)
test.describe("charm", function()
require("../packages/charm/test")
end)
test.describe("charm-sync", functi... | 152 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/array.luau | luau | .luau | local channel_state = require("../process/channel_state")
local types = require("../types")
--[[
Create a new array with the given dataTypeInterface
]]
@native
local function array<T>(value_ty: types.DataType<T>): types.DataType<{ T }>
local val_write = value_ty.write
local val_read = value_ty.read
return {
__T... | 252 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/bool.luau | luau | .luau | local types = require("../types")
local bool_modifier = {
[1] = true,
[0] = false,
}
local bool_modifier2 = {
[true] = 1,
[false] = 0,
}
local bool_data_type = {
__T = (nil :: any) :: boolean,
--[[
1 = true
0 = false
Write and read based off a uint8
]]
read = @native function(b: buffer, cursor: numb... | 172 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/buff.luau | luau | .luau | local types = require("../types")
local buff = {
read = @native function(b: buffer, cursor: number)
local length = buffer.readu16(b, cursor)
local freshBuffer = buffer.create(length)
-- copy the data from the main buffer to the new buffer with an offset of 2 because of length
buffer.copy(freshBuffer, 0, b, c... | 167 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/cframe.luau | luau | .luau | local types = require("../types")
local cframe: types.DataType<CFrame> = {
__T = ... :: CFrame,
read = @native function(b: buffer, cursor: number)
local x = buffer.readf32(b, cursor)
local y = buffer.readf32(b, cursor + 4)
local z = buffer.readf32(b, cursor + 8)
local rx = buffer.readf32(b, cursor + 12)
l... | 282 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/color3.luau | luau | .luau | local types = require("../types")
local color3 = {
__T = ... :: Color3,
write = @native function(input: Color3)
alloc(3)
uint8NoAlloc(input.R * 255)
uint8NoAlloc(input.G * 255)
uint8NoAlloc(input.B * 255)
end,
read = @native function(b: buffer, cursor: number)
return Color3.fromRGB(
buffer.readu8(b,... | 156 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/float32.luau | luau | .luau | local types = require("../types")
local float32: types.DataType<number> = {
__T = ... :: number,
write = f32,
read = @native function(b: buffer, cursor: number)
return buffer.readf32(b, cursor), 4
end,
}
return @native function(): types.DataType<number>
return float32
end
| 74 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/float64.luau | luau | .luau | local types = require("../types")
local float64: types.DataType<number> = {
__T = ... :: number,
write = writef64,
read = @native function(b: buffer, cursor: number)
return buffer.readf64(b, cursor), 8
end,
}
return @native function(): types.DataType<number>
return float64
end
| 75 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/inst.luau | luau | .luau | local types = require("../types")
return @native function(): types.DataType<Instance?>
return {
write = @native function(value)
alloc(1)
writeReference(value)
end,
read = @native function(b: buffer, cursor: number)
local refs = readRefs.get()
if not refs then
return nil, 1
end
local ref... | 131 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/int16.luau | luau | .luau | local types = require("../types")
local int16 = {
write = writei16,
read = @native function(b: buffer, cursor: number)
return buffer.readi16(b, cursor), 2
end,
}
return @native function(): types.DataType<number>
return int16
end
| 62 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/int32.luau | luau | .luau | local types = require("../types")
local int32 = {
write = writei32,
read = @native function(b: buffer, cursor: number)
return buffer.readi32(b, cursor), 4
end,
}
return @native function(): types.DataType<number>
return int32
end
| 62 |
ffrostfall/ByteNet | ffrostfall-ByteNet-fbdb156/src/data_types/int8.luau | luau | .luau | local types = require("../types")
local int8 = {
write = writei8,
read = @native function(b: buffer, cursor: number)
return buffer.readi8(b, cursor), 1
end,
}
return @native function(): types.DataType<number>
return int8
end
| 62 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.