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 |
|---|---|---|---|---|---|
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/Gizmos/PartGizmo.luau | luau | .luau | local React = require("@pkgs/React")
local e = React.createElement
local LINE_THICKNESS = 0.15
local function BoxWireframe(props: {
part: BasePart,
color: Color3?,
})
local size = props.part.Size
local x = size.X / 2
local y = size.Y / 2
local z = size.Z / 2
local sizeX = Vector3.new(size.X + LINE_THICKNESS... | 1,053 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/Icon.luau | luau | .luau | local React = require("@pkgs/React")
local useDefaultProps = require("../Hooks/useDefaultProps")
local useDpiScale = require("../Hooks/useDpiScale")
local useTheme = require("../Hooks/useTheme")
local useMemo = React.useMemo
local e = React.createElement
local memo = React.memo
export type TarmacImage = {
Image: st... | 341 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/Popover.luau | luau | .luau | local React = require("@pkgs/React")
local IconMap = require("@root/Assets/IconMap")
local LocalStore = require("@root/Stores/LocalStore")
local Preferences = require("@root/Stores/Preferences")
local BasePopover = require("./BasePopover")
local useValue = require("@root/Lib/Store").useValue
local useDpiScale = requ... | 1,174 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/StudioPlugin/StudioPlugin.luau | luau | .luau | local React = require("@pkgs/React")
local StudioPluginContexts = require("./StudioPluginContexts")
local e = React.createElement
local useContext = React.useContext
local function StudioPluginProvider(props: {
plugin: Plugin,
children: React.Node?,
})
return e(StudioPluginContexts.plugin.Provider, {
value = pr... | 113 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/StudioPlugin/StudioPluginContexts.luau | luau | .luau | local Plugin = plugin or script:FindFirstAncestorOfClass("Plugin") :: Plugin
local React = require("@pkgs/React")
local createContext = React.createContext
local pluginContext = createContext(Plugin)
local pluginToolbarContext = createContext((nil :: never) :: PluginToolbar)
return {
plugin = pluginContext,
plugin... | 75 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/StudioPlugin/StudioPluginMenu.luau | luau | .luau | local HttpService = game:GetService("HttpService")
local React = require("@pkgs/React")
local Icon = require("../Icon")
local useDpiScale = require("../../Hooks/useDpiScale")
local usePlugin = require("./StudioPlugin").usePlugin
local useEffect = React.useEffect
local createUniqueKey = require("../.../Lib/createUni... | 432 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/StudioPlugin/StudioPluginToolbar.luau | luau | .luau | local React = require("@pkgs/React")
local StudioPlugin = require("./StudioPlugin")
local StudioPluginContexts = require("./StudioPluginContexts")
local e = React.createElement
local useContext = React.useContext
local useRef = React.useRef
local useEffect = React.useEffect
local function StudioPluginToolbarProvider... | 230 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/StudioPlugin/StudioPluginToolbarButton.luau | luau | .luau | local React = require("@pkgs/React")
local StudioPluginToolbar = require("./StudioPluginToolbar")
local useRef = React.useRef
local useEffect = React.useEffect
local function StudioPluginToolbarButton(props: {
id: string,
tooltip: string?,
icon: string?,
text: string?,
enabled: boolean?,
clickableWhenViewportH... | 491 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/SurfacePickerGridView.luau | luau | .luau | local Array = require("@root/Lib/Array")
local React = require("@pkgs/React")
local SurfacePickerGridItem = require("./SurfacePickerGridItem")
local useBoolean = require("../Hooks/useBoolean")
local useTheme = require("../Hooks/useTheme")
local useEffect = React.useEffect
local createUniqueKey = require("../../Lib/c... | 577 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/SurfacePickerListItem.luau | luau | .luau | local React = require("@pkgs/React")
local LocalStore = require("@root/Stores/LocalStore")
local Preferences = require("@root/Stores/Preferences")
local SurfacePreviewIcon = require("./SurfacePreview/SurfacePreviewIcon")
local useValue = require("@root/Lib/Store").useValue
local useBoolean = require("../Hooks/useBoo... | 994 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/SurfacePickerListView.luau | luau | .luau | local Array = require("@root/Lib/Array")
local React = require("@pkgs/React")
local SurfacePickerListItem = require("./SurfacePickerListItem")
local useBoolean = require("../Hooks/useBoolean")
local useTheme = require("../Hooks/useTheme")
local useEffect = React.useEffect
local createUniqueKey = require("../../Lib/c... | 539 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/SurfacePreview/HingeMotor.luau | luau | .luau | local React = require("@pkgs/React")
local e = React.createElement
local HINGE_PART_COLOR = BrickColor.Yellow().Color
local BASE_PART_COLOR = BrickColor.Gray().Color
local function HingeMotor(props: {
isMotor: boolean,
cframe: CFrame?,
})
local hingePartRef = React.createRef() :: { current: Part? }
return e("Mo... | 427 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/SurfacePreview/SurfacePreview.luau | luau | .luau | local plugin: Plugin = script:FindFirstAncestorOfClass("Plugin")
local React = require("@pkgs/React")
local HingeMotor = require("./HingeMotor")
local useDefaultProps = require("../../Hooks/useDefaultProps")
local useMemo = React.useMemo
local createUniqueKey = require("../../../Lib/createUniqueKey")
local e = Reac... | 905 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/SurfacePreview/SurfacePreviewIcon.luau | luau | .luau | local plugin: Plugin = script:FindFirstAncestorOfClass("Plugin")
local React = require("@pkgs/React")
local HingeMotor = require("./HingeMotor")
local useDefaultProps = require("../../Hooks/useDefaultProps")
local useTheme = require("../../Hooks/useTheme")
local e = React.createElement
local memo = React.memo
loca... | 797 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Components/Tooltip.luau | luau | .luau | local GuiService = game:GetService("GuiService")
local React = require("@pkgs/React")
local IconMap = require("@root/Assets/IconMap")
local LocalStore = require("@root/Stores/LocalStore")
local Preferences = require("@root/Stores/Preferences")
local BasePopover = require("./BasePopover")
local useValue = require("@... | 1,757 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useBoolean.luau | luau | .luau | local React = require("@pkgs/React")
local useState = React.useState
local useCallback = React.useCallback
local function useBoolean(initialValue: boolean?)
local value, setValue = useState(initialValue or false)
local setEnabled = useCallback(function()
setValue(true)
end, {})
local setDisabled = useCallback... | 142 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useCurrentCamera.luau | luau | .luau | local useState = require("@pkgs/React").useState
local useEvent = require("./useEvent")
local function useCurrentCamera()
local camera, setCamera = useState(workspace.CurrentCamera)
useEvent(workspace:GetPropertyChangedSignal("CurrentCamera"), function()
if workspace.CurrentCamera then
setCamera(workspace.Curr... | 79 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useDefaultProps.luau | luau | .luau | local useMemo = require("@pkgs/React").useMemo
local function merge(...)
local result = {}
for _, object in { ... } do
if typeof(object) ~= "table" then
continue
end
for key, value in object do
result[key] = value
end
end
return result
end
local function useDefaultProps(...)
local args = { ... }... | 115 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useDpiScale.luau | luau | .luau | local useMemo = require("@pkgs/React").useMemo
local useViewport = require("./useViewport")
local calculateDpiScale = require("../Lib/calculateDpiScale")
local function useDpiScale(fallback: number?)
local viewport = useViewport()
local dpiScale = useMemo(function()
return calculateDpiScale(fallback)
end, { vie... | 93 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useEvent.luau | luau | .luau | local useEffect = require("@pkgs/React").useEffect
local useLatest = require("./useLatest")
local function useEvent<T...>(
event: RBXScriptSignal<T...>?,
callback: (T...) -> ()?,
options: {
once: boolean?,
connected: boolean?,
}?
)
local callbackRef = useLatest(callback)
local once = options and options.onc... | 223 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useLatest.luau | luau | .luau | local React = require("@pkgs/React")
local useMemo = React.useMemo
local useRef = React.useRef
type Predicate<T = unknown> = (a: T?, b: T) -> boolean
local function isStrictEqual(a: unknown?, b: unknown)
return a == b
end
local function useLatest<T>(value: T, predicate: Predicate<T>?): { current: T }
local ref = ... | 147 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useStudioTheme.luau | luau | .luau | local Studio = settings():GetService("Studio")
local React = require("@pkgs/React")
local useEvent = require("./useEvent")
local useState = React.useState
local useMemo = React.useMemo
local function getStudioThemeId(theme: StudioTheme)
local studioThemeId = theme.Name:lower()
return studioThemeId
end
local functi... | 138 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useTheme.luau | luau | .luau | -- local Studio = settings():GetService("Studio")
-- local React = require("@pkgs/React")
local DarkTheme = require("../Themes/Dark")
local function useTheme()
-- local isLight, setIsLight = React.useState(Studio.Theme.Name == "Light")
-- React.useEffect(function()
-- local connection = Studio.ThemeChanged:Conn... | 175 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hooks/useViewport.luau | luau | .luau | local useState = require("@pkgs/React").useState
local useCurrentCamera = require("./useCurrentCamera")
local useEvent = require("./useEvent")
local function useViewport()
local camera = useCurrentCamera()
local viewport, setViewport = useState(camera.ViewportSize)
useEvent(camera:GetPropertyChangedSignal("Viewpor... | 87 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Hotkeys.client.luau | luau | .luau | local UserInputService = game:GetService("UserInputService")
local LocalStore = require("@root/Stores/LocalStore")
local Preferences = require("@root/Stores/Preferences")
local keybindStrings = {
CTRL = { Enum.KeyCode.LeftControl, Enum.KeyCode.RightControl },
SHIFT = { Enum.KeyCode.LeftShift, Enum.KeyCode.RightShif... | 384 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Lib/calculateDpiScale.luau | luau | .luau | local UserInputService = game:GetService("UserInputService")
local function calculateDpiScale(fallback: number?)
local ok, scale = pcall(function()
local buttonContentId =
UserInputService:GetImageForKeyCode(Enum.KeyCode.ButtonA)
local buttonScale = buttonContentId:lower():match("@([%d%.]-)x%.%w+$")
return ... | 108 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Lib/createNextOrder.luau | luau | .luau | local function createNextOrder(startAt: number?)
local layoutOrder = startAt or 0
return function()
layoutOrder += 1
return layoutOrder
end
end
return createNextOrder
| 44 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Lib/createShortUuid.luau | luau | .luau | local HttpService = game:GetService("HttpService")
local function createShortUuid(length: number?)
local uuid = HttpService:GenerateGUID(false)
return uuid:sub(1, length and math.max(1, length) or 7):lower()
end
return createShortUuid
| 59 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Lib/formatEnumName.luau | luau | .luau | local function formatEnumName(name: string | EnumItem)
if typeof(name) == "EnumItem" then
name = name.Name
end
local formatted = (name :: string):gsub("(%l)(%u)", "%1 %2")
return formatted
end
return formatEnumName
| 61 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Lib/formatKeyCode.luau | luau | .luau | local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
local IS_MACOS = GuiService.IsWindows == false
local function formatKeyCode(keycode: (string | Enum.KeyCode)?): string?
if not keycode then
return
end
if typeof(keycode) == "string" then
return keycod... | 265 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Lib/withFont.luau | luau | .luau | local function withFont(font: Font, weight: Enum.FontWeight?, style: Enum.FontStyle?)
if font.Weight == weight and font.Style == style then
return font
end
local baseWeight = font.Weight or Enum.FontWeight.Regular
local baseStyle = font.Style or Enum.FontStyle.Normal
return Font.new(font.Family, weight or base... | 83 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Lib/withInputEvents.luau | luau | .luau | type Callback<T> = (rbx: T, input: InputObject) -> ()
local function withInputEvents(
events: {
hovered: ((rbx: GuiButton) -> ())?,
pressed: ((rbx: GuiButton) -> ())?,
},
...: Callback<GuiButton>
)
local callbacks = { ... }
return function(rbx: GuiButton, input: InputObject)
if input.UserInputType == Enum.... | 180 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/PluginFacade.luau | luau | .luau | local RuntimeScript = script.Parent.Parent
local React = require("@pkgs/React")
local IconMap = require("@root/Assets/IconMap")
local LocalStore = require("@root/Stores/LocalStore")
local Manifest = require("@root/Manifest")
local StudioPluginToolbar = require("./Components/StudioPlugin/StudioPluginToolbar")
local S... | 595 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Themes/Dark.luau | luau | .luau | return {
id = "dark",
name = "Dark",
mode = "dark",
colors = {
accent = {
default = Color3.fromHex("ffdf35"),
hovered = Color3.fromHex("ffed96"),
pressed = Color3.fromHex("c2a92a"),
disabled = Color3.fromHex("222222"),
},
onAccent = {
default = Color3.new(),
hovered = Color3.fromHex("1a1a1a"... | 801 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Themes/init.luau | luau | .luau | --!strict
local DarkTheme = require(script.Dark)
local themeMap = table.freeze({
[DarkTheme.id] = DarkTheme,
})
return themeMap
| 34 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Widgets/ContextualToolbar.luau | luau | .luau | local Selection = game:GetService("Selection")
local React = require("@pkgs/React")
local IconMap = require("@root/Assets/IconMap")
local LocalStore = require("@root/Stores/LocalStore")
local Preferences = require("@root/Stores/Preferences")
local ResurfaceApi = require("@root/ResurfaceApi")
local Button = require(... | 792 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Widgets/PrimaryToolbar.luau | luau | .luau | local React = require("@pkgs/React")
local IconMap = require("@root/Assets/IconMap")
local LocalStore = require("@root/Stores/LocalStore")
local Preferences = require("@root/Stores/Preferences")
local Button = require("../Components/Button")
local ComponentGroup = require("../Components/ComponentGroup")
local Divider... | 1,603 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Widgets/SettingsWidget.luau | luau | .luau | local plugin: Plugin = plugin or script:FindFirstAncestorOfClass("Plugin")
local StudioService = game:GetService("StudioService")
local RuntimeScript = script.Parent.Parent.Parent
local React = require("@pkgs/React")
local LocalStore = require("@root/Stores/LocalStore")
local Manifest = require("@root/Manifest")
loc... | 3,817 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Frontend/Widgets/SurfacePickerWidget.luau | luau | .luau | local UserInputService = game:GetService("UserInputService")
local Array = require("@root/Lib/Array")
local React = require("@pkgs/React")
local IconMap = require("@root/Assets/IconMap")
local LocalStore = require("@root/Stores/LocalStore")
local Preferences = require("@root/Stores/Preferences")
local Button = requi... | 1,325 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Lib/Array.luau | luau | .luau | --!strict
local function filter<T>(array: { T }, predicate: (value: T, index: number) -> any): { T }
local output = {}
for index, value in array do
if predicate(value, index) then
table.insert(output, value)
end
end
return output
end
local function map<T, U>(array: { T }, mapper: (value: T, index: number)... | 154 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Lib/Store.luau | luau | .luau | export type Value<T> =
((value: (T | (current: T) -> T)?, bypassSignals: boolean?) -> T)
& {
changed: RBXScriptSignal<T, T>,
initialValue: T,
destroy: () -> (),
reset: () -> (),
onChange: (prev: T, next: T) -> () -> (),
onReset: (() -> ())?,
}
local function Value<T>(
value: T,
api: {
validate: ((va... | 603 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Lib/createUniqueKey.luau | luau | .luau | local function createUniqueKey(existingNames: { any }?)
local names = {}
if existingNames then
for _, name in existingNames do
local stringified = tostring(name)
if names[stringified] == nil then
names[stringified] = 1
else
names[stringified] += 1
end
end
end
return function(name: any): s... | 172 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Manifest.luau | luau | .luau | local WallyManifest = require(script.Parent.WallyPackageManifest) :: WallyManifest
type WallyManifest = {
package: {
name: string,
realm: string,
registry: string,
version: string,
},
dependencies: {
[string]: string,
},
product: {
description: string,
display_name: string,
},
}
return WallyManife... | 86 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/ResurfaceApi.luau | luau | .luau | local ChangeHistoryService = game:GetService("ChangeHistoryService")
local MaterialService = game:GetService("MaterialService")
local MaterialVariants = require("@root/Assets/MaterialVariants")
local createUniqueKey = require("@root/Lib/createUniqueKey")
local NORMAL_IDS: { Enum.NormalId } = Enum.NormalId:GetEnumIte... | 1,568 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Stores/LocalStore.luau | luau | .luau | local plugin: Plugin = plugin or script:FindFirstAncestorOfClass("Plugin")
local Store = require("@root/Lib/Store")
local Value = Store.Value
type Value<T> = Store.Value<T>
local validWidgetIds = {
settings = true,
surfacePicker = true,
}
local store = {
isPluginActive = Value(false),
currentWidget = Value(nil,... | 214 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/Stores/Preferences.luau | luau | .luau | local Store = require("@root/Lib/Store")
local Value = Store.Value
type Value<T> = Store.Value<T>
type Keybind = Enum.KeyCode | "CTRL" | "SHIFT" | "ALT"
local sessionSyncedPreferences = {
isReducedMotion = true,
transparencyScale = true,
}
local store = {
selectedSurface = Value(Enum.SurfaceType.Studs),
applyT... | 1,056 |
cxmeel/resurface-plugin | cxmeel-resurface-plugin-a9915a3/src/init.client.luau | luau | .luau | local CoreGui = game:GetService("CoreGui")
local Janitor = require("@pkgs/Janitor")
local React = require("@pkgs/React")
local ReactRoblox = require("@pkgs/ReactRoblox")
local LocalStore = require("./Stores/LocalStore")
-- Migrations to ease transition from Surface Tool
if plugin:GetSetting("currentVersion") ~= nil ... | 478 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/analyze.luau | luau | .luau | --> Task to typecheck packages using luau-lsp
local task = require("./task")
task.new("luau-lsp")
:addArgument("analyze")
:addArgument("--base-luaurc=.luaurc")
:addArgument("--settings=.vscode/settings.json")
:addArgument("--defs=globalTypes.d.luau")
:addArgument("--ignore=**/luau_packages/**")
:addArgument("--... | 132 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/bundle.luau | luau | .luau | --> Task to typecheck packages using luau-lsp
local task = require("./task")
task.new("pesde"):addArgument("install"):setcwd("packages/api_types"):execute()
task.new("lune"):addArgument("run"):addArgument("bundle"):setcwd("packages/api_types"):execute()
| 64 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/fmt.luau | luau | .luau | --> Task to execute StyLua for checking validity of formatting
local task = require("./task")
task.new("stylua")
:addArgument("--check")
:addArgument("--output-format")
:addArgument("Summary")
:addArgument("packages")
:execute()
| 54 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/lint.luau | luau | .luau | --> Task for linting packages using selene
local task = require("./task")
task.new("selene"):addArgument("packages"):execute()
| 30 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/script.luau | luau | .luau | --> run a script, scripts can be found under ./lune/scripts
-- scripts are generally just luau files that are quickly put together in order to achieve something quickly -
-- such as automating files
-- NOTE: we're using the `Lune` runtime in the CI/CD environment, so we're not going to be using the `@std-polyfills`
-... | 212 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/scripts/countAliases.luau | luau | .luau | local fs = require("@lune/fs")
local process = require("@lune/process")
local packageDir = process.args[1]
local function patchFile(dir, fileName)
local fileData = fs.readFile(`{dir}/{fileName}`)
for requirePath: string in fileData.gmatch(fileData, 'local %S+ = require%("(%S+)"%)') do
if string.sub(requirePath, ... | 172 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/scripts/fsIntoTable.luau | luau | .luau | local fs = require("@lune/fs")
local process = require("@lune/process")
local luaTableSource = "{\n"
local packageDir = process.args[1]
local function readFile(dir, fileName)
local fileName = string.sub(fileName, 1, -6)
local source = `{dir}/{fileName}`
luaTableSource = `local {fileName} = require("{string.gsub(s... | 259 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/task/requireTests.luau | luau | .luau | --> Runs tests located in the tests/ directory
-- NOTE: we're using the `Lune` runtime in the CI/CD environment, so we're not going to be using the `@std-polyfills`
-- package that the discord-luau package uses.
local fs = require("@lune/fs")
local stdio = require("@lune/stdio")
local process = require("@lune/process... | 280 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.lune/test.luau | luau | .luau | --> Task for running unit-tests using frktest
local frktest = require("../lune_packages/frktest")
local reporter = frktest._reporters.lune_console_reporter
local requireTests = require("./task/requireTests")
requireTests("./packages")
reporter.init()
if not frktest.run() then
print("--------------------")
error(... | 87 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/.nvim.lua | luau | .lua | require("@self/luau-lsp").config({
server = {
settings = {
["luau-lsp"] = {
inlayHints = {
variableTypes = true,
functionReturnTypes = true,
parameterNames = "all",
typeHintMaxLength = 20,
},
require = {
mode = "relativeToFile",
directoryAliases = {},
},
completio... | 130 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/globalTypes.d.luau | luau | .luau | declare function warn<T...>(...: T...)
declare game: any
declare workspace: any
| 20 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/.lune/bundle.luau | luau | .luau | --> Task to execute Darklua for bundling the various packages apart of Discord-Luau
local task = require("../../../.lune/task")
task.new("darklua")
:addArgument("process")
:addArgument("src/init.luau")
:addArgument("bundled.luau")
:addArgument(`-cdarklua.json`)
:execute()
task.new("stylua"):addArgument("bundled... | 128 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/application.luau | luau | .luau | --[=[
@class Types.application
]=]
local util = require("../luau_packages/util")
local MembershipState = table.freeze(util.tableReflect({
Invited = 1,
Accepted = 2,
}))
local IntegrationTypesConfig = table.freeze(util.tableReflect({
GuildInstall = 0,
UserInstall = 1,
}))
export type MembershipState = "Invited"... | 326 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/channel.luau | luau | .luau | --[=[
@class Types.channel
]=]
local util = require("../luau_packages/util")
local apiTypes = require("./apiTypes")
local ChannelTypes = table.freeze(util.tableReflect({
GuildText = 0,
DM = 1,
GuildVoice = 2,
GroupDM = 3,
GuildCategory = 4,
GuildAnnouncement = 5,
AnnouncementThread = 10,
PublicThread = 11,
... | 790 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/client.luau | luau | .luau | --[=[
@class Types.client
]=]
local util = require("../luau_packages/util")
local ActivityType = table.freeze(util.tableReflect({
Game = 0,
Streaming = 1,
Listening = 2,
Watching = 3,
Competing = 5,
}))
local Status = table.freeze(util.tableReflect({
Online = "online",
DoNotDisturb = "dnd",
Idle = "idle",
... | 170 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/embed.luau | luau | .luau | --[=[
@class Types.embed
]=]
local util = require("../luau_packages/util")
local EmbedType = table.freeze(util.tableReflect({
Rich = "rich",
Image = "image",
Video = "video",
Gifv = "gifv",
Article = "article",
Link = "link",
PollResult = "poll_result",
}))
export type EmbedType = "Rich" | "Image" | "Video" ... | 120 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/entitlement.luau | luau | .luau | --[=[
@class Types.entitlement
]=]
local util = require("../luau_packages/util")
local EntitlementType = table.freeze(util.tableReflect({
Purchase = 1,
PremiumSubscription = 2,
DeveloperGift = 3,
TestModePurchase = 4,
FreePurchase = 5,
UserGift = 6,
PremiumPurchase = 7,
ApplicationSubscription = 8,
}))
expo... | 150 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/gateway/closeCodes.luau | luau | .luau | --[=[
@class Types.gateway.closeCodes
https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
]=]
local CloseCodes = table.freeze({
UnknownError = 4000,
UnknownOpcode = 4001,
DecodeError = 4002,
NotAuthenticated = 4003,
AuthenticationFailed = 4004,
AlreadyAuthenti... | 263 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/gateway/intents.luau | luau | .luau | --[=[
@class Types.gateway.intents
https://discord.com/developers/docs/topics/gateway#list-of-intents
]=]
local Intents = table.freeze({
Guilds = 0,
GuildMembers = 1,
GuildModeration = 2,
GuildEmojisAndStickers = 3,
GuildIntegrations = 4,
GuildWebhooks = 5,
GuildInvites = 6,
GuildVoiceStates = 7,
GuildPres... | 371 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/gateway/opcodes.luau | luau | .luau | --[=[
@class Types.gateway.opcodes
https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes
]=]
local Opcodess = table.freeze({
Dispatch = 0,
Heartbeat = 1,
Identify = 2,
PresenceUpdate = 3,
VoiceStateUpdate = 4,
Resume = 6,
Reconnect = 7,
RequestGuildMembers = 8,
Invalid... | 195 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/gateway/receiveEvents.luau | luau | .luau | --[=[
@class Types.gateway.receiveEvents
https://discord.com/developers/docs/topics/gateway-events#receive-events
these enums map to the `T` event name given in a Discord payload;
https://discord.com/developers/docs/topics/gateway-events#payload-structure
]=]
local ReceiveEvents = table.freeze({
Hello = "HELL... | 1,303 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/gateway/sendEvents.luau | luau | .luau | --[=[
@class Types.gateway.sendEvents
https://discord.com/developers/docs/topics/gateway-events#send-events
these enums map to the `opcodes` module under `@api-types/gateway/optcodes.luau`
]=]
local SendEvents = table.freeze({
Identify = "Identify",
Resume = "Resume",
Heartbeat = "Heartbeat",
RequestGuildMemb... | 144 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/guild.luau | luau | .luau | --[=[
@class Types.guild
]=]
local util = require("../luau_packages/util")
local VerificationLevel = table.freeze(util.tableReflect({
None = 0,
Low = 1,
Medium = 2,
High = 3,
VeryHigh = 4,
}))
local DefaultMessageNotification = table.freeze(util.tableReflect({
AllMessages = 0,
OnlyMentions = 1,
}))
local Ex... | 1,836 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/interaction.luau | luau | .luau | --[=[
@class Types.interaction
]=]
local util = require("../luau_packages/util")
local InteractionType = table.freeze(util.tableReflect({
Ping = 1,
ApplicationCommand = 2,
MessageComponent = 3,
ApplicationCommandAutocomplete = 4,
ModalSubmit = 5,
}))
local ApplicationCommandOptionType = table.freeze(util.table... | 518 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/permission.luau | luau | .luau | --[=[
@class Types.permission
]=]
local util = require("../luau_packages/util")
local bit = require("../luau_packages/bit")
local Permissions = table.freeze(util.tableReflect({
CreateInstantInvite = bit.lshift(1, 0),
KickMembers = bit.lshift(1, 1),
BanMembers = bit.lshift(1, 2),
Administrator = bit.lshift(1, 3)... | 998 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/poll.luau | luau | .luau | --[=[
@class Types.poll
]=]
export type PollLayoutType = "Default"
return "DISCORD_V10_APPLICATION_TYPES"
| 27 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/sticker.luau | luau | .luau | --[=[
@class Types.sticker
]=]
local util = require("../luau_packages/util")
local StickerTypes = table.freeze(util.tableReflect({
Standard = 1,
Guild = 2,
}))
local StickerFormatTypes = table.freeze(util.tableReflect({
PNG = 1,
APNG = 2,
LOTTIE = 3,
GIF = 4,
}))
export type StickerType = "Standard" | "Guild... | 150 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/user.luau | luau | .luau | --[=[
@class Types.user
]=]
local util = require("../luau_packages/util")
local NitroType = table.freeze(util.tableReflect({
None = 0,
NitroClassic = 1,
Nitro = 2,
NitroBasic = 3,
}))
export type NitroType = "None" | "NitroClassic" | "Nitro" | "NitroBasic"
return {
NitroType = NitroType,
}
| 97 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/api_types/src/webhook.luau | luau | .luau | --[=[
@class Types.webhook
]=]
local util = require("../luau_packages/util")
local WebhookType = table.freeze(util.tableReflect({
Incoming = 1,
ChannelFollower = 2,
Application = 3,
}))
export type WebhookType = "Incoming" | "ChannelFollower" | "Application"
return {
WebhookType = WebhookType,
}
| 82 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/bit/src/bit64.luau | luau | .luau | --[[
An optimized 64-bit library to provide 64-bit binary operations in Luau
using 32-bit operations and `bit32` for improved performance.
]]
local Bit64 = {}
--[[
Splits a 64-bit integer into high and low 32-bit integers
]]
local function split64(value: number): (number, number)
local low = bit32.band(value, 0xFF... | 647 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/bit/src/init.luau | luau | .luau | --[=[
@class Bit
A Bit wrapper library that supports both 64-bit integers and 32-bit integers.
Primarily required in the calculation for snowflake IDs that the Discord API will give us.
]=]
local Bit64 = require("@self/bit64")
local Bit = {}
--[=[
@within Bit
Returns true if the given value is a 32-bit intege... | 494 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/builders/src/activity.luau | luau | .luau | --[=[
@class Builders.Activity
@__index Prototype
Implementation of Discord Activity as a Luau builder.
https://discord.com/developers/docs/events/gateway-events#activity-object
Note: Only YouTube and Twitch URLs are allowed for streaming.
]=]
local apiTypes = require("../luau_packages/api_types")
local Acti... | 771 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/builders/src/automoderation/rule.luau | luau | .luau | --[=[
@class Builders.AutomoderationRule
@__index Prototype
Implementation of a discord automoderation rule object as a luau builder.
https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object
]=]
local apiTypes = require("../../luau_packages/api_types")
local triggerMetadata = req... | 1,605 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/builders/src/init.luau | luau | .luau | local provider = require("@self/embed/provider")
local field = require("@self/embed/field")
local thumbnail = require("@self/embed/thumbnail")
local embed = require("@self/embed/embed")
local author = require("@self/embed/author")
local image = require("@self/embed/image")
local footer = require("@self/embed/footer")
l... | 1,474 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/builders/src/presence.luau | luau | .luau | --[=[
@class Builders.Presence
@__index Prototype
Implementation of a Discord Presence as a Luau builder.
https://discord.com/developers/docs/events/gateway-events#update-presence
]=]
local apiTypes = require("../luau_packages/api_types")
local activity = require("./activity")
local Presence = {}
Presence.Pr... | 832 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/classes/src/bitflags/application.luau | luau | .luau | --[=[
@class Classes.ApplicationBitflag
@__index Prototype
Implementation of the Discord Application Bitflags in Luau.
This class provides methods to check various application flags that indicate different states and capabilities of a Discord application.
https://discord.com/developers/docs/resources/application... | 978 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/classes/src/channels/construct.luau | luau | .luau | -- selene: allow(unused_variable)
local state = require("../../luau_packages/state")
local apiTypes = require("../../luau_packages/api_types")
local dmChannel = require("./types/dm")
local groupDmChannel = require("./types/groupDm")
local guildAnnouncement = require("./types/guildAnnouncement")
local guildCategory = r... | 568 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/classes/src/init.luau | luau | .luau | local provider = require("@self/embed/provider")
local field = require("@self/embed/field")
local thumbnail = require("@self/embed/thumbnail")
local embed = require("@self/embed/embed")
local author = require("@self/embed/author")
local image = require("@self/embed/image")
local footer = require("@self/embed/footer")
l... | 3,614 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/discord_luau/src/init.luau | luau | .luau | local bot = require("@self/bot")
--[=[
@class DiscordLuau
Top level documentation for the Discord-Luau library, welcome! 👋
This package will represent the entrypoint to your adventure using Discord-Luau, through this package you'll generate
a discord Bot object, this bot Object enables you to write discord bots... | 160 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/example/src/init.luau | luau | .luau | local discordLuau = require("@self/../luau_packages/discord")
local discordBuilders = require("@self/../luau_packages/builders")
local env = require("@self/../../../.env")
local discordBot = discordLuau.bot.new({
token = env.DISCORD_BOT_TOKEN,
intents = discordBuilders.intents.new({ "Guilds", "GuildMessages" }):bui... | 118 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/rest/src/init.luau | luau | .luau | local applicationRoleConnectionMetadata = require("@self/applicationRoleConnectionMetadata")
local invite = require("@self/invite")
local gateway = require("@self/gateway")
local emoji = require("@self/emoji")
local stageInstance = require("@self/stageInstance")
local application = require("@self/application")
local re... | 825 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/secret/src/init.luau | luau | .luau | --[=[
@class Secret
@__index Prototype
Implementation of a basic secret object in Luau, primarily used to store bot tokens so that
they can't be accidentally leaked into the console through a `print`
```luau
local a
a = secret.new("SOMETHING_SECRET")
print(a) --> "Secret(SOMETHIN--------)"
a = secret.new(... | 492 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/snowflake/src/init.luau | luau | .luau | --[=[
@class Snowflake
@__index Prototype
Wrapper around Discord snowflakes, allwowing developers to query information about a snowflake
]=]
local stdPolyfills = require("../lune_packages/std_polyfills")
local bit = require("../luau_packages/bit")
local DISCORD_EPOCH = 1420070400000
local Snowflake = {}
Snowfl... | 478 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/std_polyfills/src/datetime.luau | luau | .luau | --[=[
@class StdPolyfills.datetime
]=]
local runtime = require("./runtime")
local datetime = {}
--[=[
@within StdPolyfills.datetime
Creates a new DateTime from an ISO 8601 date-time string.
]=]
function datetime.fromIsoDate(isoDate: string): DateTime
local target = runtime.assertRuntime()
if target == "Lune" ... | 317 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/std_polyfills/src/lune/net.luau | luau | .luau | local net = setmetatable({}, { __index = require("@lune/net") })
net.socket = function(...)
local socket = require("@lune/net").socket(...)
local value = setmetatable({}, {
__index = socket,
})
function value.next(...: any)
return socket:next(...)
end
function value.close(...: any)
return socket:close(..... | 102 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/std_polyfills/src/process.luau | luau | .luau | --[=[
@class StdPolyfills.process
]=]
local runtime = require("./runtime")
local process = {}
--[=[
@within StdPolyfills.process
Returns the current OS thats being used
]=]
function process.getPlatform(): OS
local target = runtime.assertRuntime()
if target == "Lune" then
return require("./lune/process").os ... | 106 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/std_polyfills/src/runtime.luau | luau | .luau | --[=[
@class StdPolyfills.runtime
]=]
local LUNE_STRING_MATCH = "(Lune) (%d+%.%d+%.%d+.*)+(%d+)"
local ZUNE_STRING_MATCH = "(Zune) (%d+%.%d+%.%d+.*)+(%d+%.%d+)"
local runtime = {}
--[=[
@within StdPolyfills.runtime
Will return the Runtime that this code is being executed under.
]=]
function runtime.getRuntime():... | 350 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/std_polyfills/src/serde.luau | luau | .luau | --[=[
@class StdPolyfills.serde
]=]
local runtime = require("./runtime")
local serde = {}
--[=[
@within StdPolyfills.serde
Encodes the given value using the given format.
]=]
function serde.encode(format: EncodeDecodeFormat, value: any, pretty: boolean?): string
local target = runtime.assertRuntime()
if targe... | 421 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/std_polyfills/src/task.luau | luau | .luau | --[=[
@class StdPolyfills.task
]=]
local runtime = require("./runtime")
local task = {}
--[=[
@within StdPolyfills.task
Stops a currently scheduled thread from resuming.
]=]
function task.cancel(thread: thread)
local target = runtime.assertRuntime()
if target == "Lune" then
return require("./lune/task").can... | 522 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/utilities/src/coroutine/run.luau | luau | .luau | --[=[
@function Utilities.coroutineRun
@within Utilities
Creates a thread, resumes that thread - and handles errors if this resumed thread fails.
Will return the thread spawned.
@return thread
]=]
return function(func: () -> (), ...)
local thread = coroutine.create(func)
local status, result = coroutine.resum... | 89 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/utilities/src/createGuid.luau | luau | .luau | local template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
--[=[
@function Utilities.createGuild
@within Utilities
Generates a random Guid (v4) that we can use to apply a unique identifier to objects.
@return string
]=]
return function()
local guid = string.gsub(template, "[xy]", function(c)
local value = (c == ... | 118 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/utilities/src/init.luau | luau | .luau | --[=[
@class Utilities
Interface for the discord-luau Utilities package
]=]
return {
validateKebabCase = require("@self/validateKebabCase"),
createGuid = require("@self/createGuid"),
coroutineRun = require("@self/coroutine/run"),
tableReflect = require("@self/table/reflect"),
}
| 71 |
DiscordLuau/discord-luau | DiscordLuau-discord-luau-d5a231e/packages/utilities/src/table/reflect.luau | luau | .luau | --[=[
@function Utilities.tableReflect
@within Utilities
Will swap the K, V's, as well as keep the original K, Vs, for example:
```luau
local a = { a = 1, b = 2, c = 3 }
tableReflect(a)
--[[
a = {
-- default values
a = 1,
b = 2,
c = 3,
-- reflected values
[1] = "a",
[2] = "b",
[3] = "c"
}... | 185 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.