Hello, Roblox Developers!
I’m excited to introduce you to GistUtil, a powerful new utility module that I’ve been working on. This module is designed to streamline your development process by providing an easy way to interact with GitHub’s Gist API directly from your Roblox games.
Features
GistUtil comes packed with a variety of features, including:
- JSON Encoding and Decoding: Easily convert tables to JSON strings and vice versa.
- Gist Creation and Deletion: Create and delete gists with ease.
- Gist Reading and Writing: Read the content of a gist or write new content to it.
- File Reading and Writing within a Gist: Read and write to specific files within a gist.
Benefits
Here’s how GistUtil can benefit you:
- Efficiency: By providing a simple and intuitive interface for interacting with the Gist API, GistUtil can save you time and effort in your development process.
- Flexibility: Whether you need to store data, share code snippets, or anything else, GistUtil gives you the power to do it all directly from your Roblox games.
- Ease of Use: With clear function names and documentation, GistUtil is easy to use even for developers who are new to working with APIs.
Absolutely, I can provide a brief explanation for each function in the GistUtil module. Here’s an updated version of the “How to Use GistUtil” section with explanations for each function:
How to Use GistUtil
To get started with GistUtil, you can require the module in your code and start calling its functions. Here’s a brief explanation of each function:
-
encode(data: table?): JSONString?: This function takes a table and converts it into a JSON string. If the input is already a string, it simply returns the input.
-
decode(data: JSONString?): table: This function takes a JSON string and converts it into a table. If the input is already a table, it simply returns the input.
-
new(id: string, token: string): Gist: This function creates a new Gist object with the given ID and token.
-
create(token: string, fileName: string?, content: JSONString?): table: This function creates a new gist with the given token, file name, and content. The file name defaults to “README.md” and the content defaults to “Hello, world!” if not provided.
-
delete(gist: Gist): table: This function deletes the given gist.
-
read(gist: Gist): table: This function reads the content of the given gist.
-
readFile(gist: Gist, fileName: string): table: This function reads the content of a specific file within the given gist.
-
write(gist: Gist, data: JSONString): table: This function writes new content to the given gist.
-
writeFile(gist: Gist, fileName: string, data: JSONString): table: This function writes new content to a specific file within the given gist.
Here’s a simple example of creating a new gist:
local gistUtil = require(path.to.gistUtil)
local token = "your GitHub token"
local fileName = "example.txt"
local content = "Hello, world!"
local response = gistUtil.create(token, fileName, content)
Please replace "your GitHub token"
with your actual GitHub token. You can find more detailed usage instructions in the comments of the module’s code.
I’m excited to see what you all create with GistUtil! If you have any questions or need help, feel free to ask. I’m here to help.
Happy developing!