A decoupled implementation of the Codify plugin's internal "Instance-to-snippet" conversion module.
Looking for the Codify plugin?
Codify converts Roblox Instances into code snippets in a flash. Whether you use vanilla Roblox Luau, TypeScript JSX, or a framework like React/Roact, Fusion, Vide or Rojo, Codify’s got you covered!
The following individuals have contributed to the development of CodifyLib:
- @boatbomber - Implemented original generators for Fusion and vanilla Roblox.
- @PepeElToro41 - Implemented original JSX generator.
local CodifyLib = require("path/to/CodifyLib")
local Generators = CodifyLib.Generators
-- Setup the React generator with a custom config
local react = Generators.React({
indentation = " ",
createMethod = "e",
names = "all",
})
-- Generate the snippet, targeting the Baseplate
-- with a custom config
local snippet = CodifyLib.codify(workspace.Baseplate, {
generator = react,
caseFormat = "camel", -- Render keys/variables in camelCase
userFormats = {
color3 = "hex", -- Render Color3 values as hex
},
})
print("Snippet:", snippet)
CodifyLib comes with a variety of generators to suit your needs:
Generates vanilla Roblox Lua code (i.e.
Instance.new
).
type Config = {
indentation: string?, -- default: " "
names: ("all" | "none" | "changed")?, -- default: "all"
}?
Fusion is a reactive framework for Roblox Luau, created by @dphfox.
Learn more →
type Config = {
indentation: string?, -- default: " "
createMethod: string?, -- default: "scope:New"
childrenKey: string?, -- default: "Children"
names: ("all" | "none" | "changed")?, -- default: "all"
}
React for Roblox is a translation of React17 from JavaScript to Lua by @roblox and @jsdotlua.
Learn more →
type Config = {
indentation: string?, -- default: " "
createMethod: string?, -- default: "React.createElement"
names: ("all" | "none" | "changed")?,
}
JSX allows HTML-like syntax to be used in TypeScript for Roblox. It is part of the roblox-ts project.
Learn more →
type Config = {
indentation: string?, -- default: " "
names: ("all" | "none" | "changed")?, -- default: "all"
lowercaseKeyProp: boolean?, -- default: false
}
CodifyLib allows you to define the way datatypes are formatted in the resulting snippets. This can be useful for customizing the output to match your coding style.
The default for all values is "full"
.
type UserFormats = {
color3: "full" | "hex" | "hsv" | "rgb",
udim2: "full",
numberRange: "full",
enum: "full" | "number" | "string",
normalId: "full",
brickColor: "full" | "number" | "rgb",
physicalProperties: "full",
udim: "full",
cframe: "full",
vector2: "full",
vector3: "full",
font: "full",
colorSequence: "full",
numberSequence: "full",
}
Codify for Roblox Studio
Purchase on Roblox | Purchase on Itch.io | Learn more