Categories > Coding > Lua >
[RELEASE] JSON Config Lib
Posted
Hello there.
I made this really tiny library that uses HttpService:JSONEncode() and HttpService:JSONDecode() to work.
This is really useful in most cases when making a script. This makes writing config files way easier than before.
I did nothing much other than making the lib.
Remember, You can only read configs that exist, So don't forget to write one before reading it lol.
Here is the loadstring and documentation:
local lib = loadstring(game:HttpGet("https://raw.githubusercontent.com/AlexDevlpr/JSON-Config-Library-for-Roblox-Lua/main/Library.lua"))()
--VISIT THE GITHUB REPO FOR MORE INFORMATION (UPDATED) : https://github.com/AlexDevlpr/JSON-Config-Library-for-Roblox-Lua
--[[
void WriteConfig(fileName, content)
Writes a JSON config file with the given filename and content.
void ReadConfig(fileName)
Returns a table from the read config which you can use.
bool IsConfig(fileName)
Returns true if the config exists, false if not.
]]
Here are examples for all of the functions in the lib:
--Write Config
local lib = loadstring(game:HttpGet("https://raw.githubusercontent.com/AlexDevlpr/JSON-Config-Library-for-Roblox-Lua/main/Library.lua"))()
local example_table = {
money = 20,
isbroke = true,
msg = "This is a example script lol"
}
lib.WriteConfig("example_config", example_table)
--[[
Output: Nothing, It writes a config with the given data.
]]
--Read Config
local lib = loadstring(game:HttpGet("https://raw.githubusercontent.com/AlexDevlpr/JSON-Config-Library-for-Roblox-Lua/main/Library.lua"))()
local table_uwu = lib.ReadConfig("example_config")
print("I have $"..tostring(table_uwu.money))
print("I am broke? That is "..tostring(table_uwu.isbroke))
print(table_uwu.msg)
--[[
Output:
I have $20
I am broke? That is true
This is a example script lol
]]
--IsConfig (Probably useless as WriteConfig has a file handler [*writefile()])
local lib = loadstring(game:HttpGet("https://raw.githubusercontent.com/AlexDevlpr/JSON-Config-Library-for-Roblox-Lua/main/Library.lua"))()
print(lib.IsConfig("example_config"))
--[[
Output:
true
]]
UPDATE:
Moved from pastebin to GitHub.
Repo here: JSON Config Library for Roblox Lua
https://media.discordapp.net/attachments/994643402949926956/1004560140252495960/uqJXQIda.gif
Discord: Ad#1085; Don't hesitate to DM me if you need help/anything.
Replied
this honestly seems useless, but im sure someone out there might need this
Cancel
Post
10 years ago
Replied
Thanks to your library I just learned knowledge about Lua tables lmao
Anyways, vouch, cool release
Cancel
Post
Random quote here...
Replied
this doesn't seem useless at all, this actually seems useful if you're making a script and want your users to be able to save their config fast and easy. I'm not sure if a script developer would include the library instead of just implementing it into their script but still a good addition.
Cancel
Post
https://media.discordapp.net/attachments/1044764388546068510/1051935933836050482/Signature_4.png
10 years ago
Replied
nice very cool
Cancel
Post
exploits i use: kiwi x
Replied
epic epic :vouch:
Cancel
Post
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post