Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

⚙️Config Library Visitors

Library Install Documentation Examples Contact Information

Config Library simplifies saving and loading script settings in Roblox executor environments. It solves the common issue where standard JSON encoders convert complex Luau data types into null or strip them out completely.

By automatically serializing native Roblox objects into tagged string signatures prior to JSON encoding, the library preserves your settings and re-instantiates them into native objects upon loading.

💡Quick Start: The core functions of this library are SaveConfig for serializing and storing settings to disk, and LoadConfig for retrieving and restoring them back into native Luau objects.


❓How It Works

1. Saving Configurations

When saving, the library converts complex Luau types into serialized string signatures before translating the settings table into JSON.

Color3.fromRGB(255, 255, 255) (Raw Object) $\rightarrow$ "Color3_(255, 255, 255)" (Saved Signature)

2. Loading Configurations

When loading, the library decodes the JSON data back into a Lua table and scans for signature types, restoring each string into its original Roblox object.

"Vector3_(10, 50, 20)" (Saved Signature) $\rightarrow$ Vector3.new(10, 50, 20) (Restored Object)


💽Supported Datatype Signatures

The library automatically maps the following Roblox datatypes:

Native Luau Object Serialized String Signature
Color3.fromRGB(...) "Color3_(...)"
Vector3.new(...) "Vector3_(...)"
Vector2.new(...) "Vector2_(...)"
CFrame.new(...) "CFrame_(...)"
Enum[...] "EnumItem_(...)"

🛠️System Requirements

To read and write files locally, your executor environment must support the following standard filesystem API functions:

  • readfile
  • writefile
  • isfile
  • isfolder
  • makefolder

💻Integrate

You can load this library into your script's environment by copying the code below.

local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/Exunys/Config-Library/main/Main.lua"))()

📑API Reference

ConfigLibrary.Encode

Encodes a Lua table into a JSON-formatted string.

ConfigLibrary.Encode(Table: table) -> string
Parameter Type Description
Table table The Lua table to encode.

Returns: string — JSON-encoded string.

View Example
print(ConfigLibrary.Encode({Bool = true})) 
-- Output: {"Bool":true}

ConfigLibrary.Decode

Decodes a JSON string and converts it back into a Lua table.

ConfigLibrary.Decode(Content: string) -> table
Parameter Type Description
Content string The JSON string to decode.

Returns: table — Decoded Lua table.

View Example
print(ConfigLibrary.Decode([[{"Bool":true}]])[1]) 
-- Output: true

ConfigLibrary:Recursive

Iterates recursively through nested tables and executes a callback function for every index-value pair found.

ConfigLibrary:Recursive(Table: table, Callback: function)
Parameter Type Description
Table table The target table (including nested sub-tables).
Callback function Function called with parameters (index, value).
View Example & Output
local TestTable = {
    Bool = true,
    Number = 123,
    String = "Hello",
    Color = Color3.fromRGB(255, 255, 255),
    InnerTable = {
        Color2 = Color3.fromRGB(150, 150, 150),
        InnerInnerTable = {
            Color3_ = Color3.fromRGB(100, 100, 100),
            Vector3_ = Vector3.new(50, 200, 100),
            Vector2_ = Vector2.new(10, 20),
            InnerInnerInnerTable = {
                Key = Enum.KeyCode.X
            }
        }
    }
}

ConfigLibrary:Recursive(TestTable, warn)

Recursive Output


ConfigLibrary.EditValue

Converts a supported native Luau data type into the library's custom string signature.

ConfigLibrary.EditValue(Value: any) -> any
Parameter Type Description
Value any The Luau value to convert.

Returns: any — The converted signature string (or original value if unsupported).

View Example
print(ConfigLibrary.EditValue(Color3.fromRGB(50, 100, 200))) 
-- Output: Color3_(50, 100, 200)

ConfigLibrary.RestoreValue

Restores a serialized signature string back into its native Luau data type.

ConfigLibrary.RestoreValue(Value: any) -> any
Parameter Type Description
Value any The signature string to parse.

Returns: any — Native Luau object or original value.

View Example
print(ConfigLibrary.RestoreValue("Color3_(50, 100, 200)")) 
-- Output: Color3 object (50, 100, 200)

ConfigLibrary:CloneTable

Performs a deep clone of the provided table and returns the new copy.

ConfigLibrary:CloneTable(Table: table) -> table
Parameter Type Description
Table table The table to duplicate.

Returns: table — Cloned instance.

View Example & Output
local TestTable = {
    Bool = true,
    Number = 123,
    InnerTable = {
        Key = Enum.KeyCode.X
    }
}

local Clone = ConfigLibrary:CloneTable(TestTable)

print(TestTable == Clone) -- Output: false

Clone Output


ConfigLibrary:ConvertValues

Mass-converts all values within a table (recursively) using the specified method.

ConfigLibrary:ConvertValues(Data: table, Method: "Edit" | "Restore") -> table
Parameter Type Description
Data table The table containing values to convert.
Method string "Edit" to apply signatures, or "Restore" to convert back to objects.

Returns: table — Processed table.

View Example & Output
local ConvertedTable = ConfigLibrary:ConvertValues(TestTable, "Edit")
ConfigLibrary:Recursive(ConvertedTable, warn)

Convert Output


ConfigLibrary:SaveConfig

Converts complex values in a table to signatures, encodes it to JSON, and writes it to disk. Generates required folders automatically if they do not exist.

ConfigLibrary:SaveConfig(Path: string, Data: table)
Parameter Type Description
Path string File destination path (e.g., "Folder/Subfolder/Config.json").
Data table The configuration table to save.
View Example & Output
ConfigLibrary:SaveConfig("a/b/c/d/test.json", TestTable)

Save Output 1 Save Output 2


ConfigLibrary:LoadConfig

Reads a JSON file from disk, parses it into a Lua table, and restores all serialized signature strings back to native Luau objects.

ConfigLibrary:LoadConfig(Path: string) -> table
Parameter Type Description
Path string File path to load.

Returns: table — Restored configuration table.

View Example & Output
local LoadedConfig = ConfigLibrary:LoadConfig("a/b/c/d/test.json")
ConfigLibrary:Recursive(LoadedConfig, warn)

Load Output


📝Usage Examples

1. Saving Configuration

local ConfigLib = loadstring(game:HttpGet("https://raw.githubusercontent.com/Exunys/Config-Library/main/Main.lua"))()

local ESP_Settings = {
    TextColor = Color3.fromRGB(255, 0, 0),
    Outline = true,
    OutlineColor = Color3.fromRGB(0, 0, 0),
    Transparency = 0.7
}

ConfigLib:SaveConfig("My Cool Hub/Config.json", ESP_Settings)
View Output Files

Save Example 1 Save Example 2


2. Loading Configuration

local ConfigLib = loadstring(game:HttpGet("https://raw.githubusercontent.com/Exunys/Config-Library/main/Main.lua"))()

local ESP_Settings = ConfigLib:LoadConfig("My Cool Hub/Config.json")

3. One-Liner Inline Saving

loadstring(game:HttpGet("https://raw.githubusercontent.com/Exunys/Config-Library/main/Main.lua"))():SaveConfig("test.json", {
    b = "c", 
    d = {
        e = "f", 
        g = {
            h = "i", 
            j = {"k"}
        }
    }
})

Generated JSON output (test.json):

{
  "b": "c",
  "d": {
    "e": "f",
    "g": {
      "h": "i",
      "j": ["k"]
    }
  }
}

📧Contact Information

About

A library for ROBLOX Script Executors to load / save configurations (supports types Color3, Vector3/2, CFrame, EnumItems...)

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages