Categories > Coding > Lua >

[RELEASE] JSON Config Lib

Posts: 381

Threads: 42

Joined: Feb, 2021

Reputation: 9

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

  • 0

Added

@atari thanks dedi atawi

  • 0

https://media.discordapp.net/attachments/994643402949926956/1004560140252495960/uqJXQIda.gif

Read me.

Discord: Ad#1085; Don't hesitate to DM me if you need help/anything.

Posts: 190

Threads: 19

Joined: Jul, 2021

Reputation: 6

Replied

this honestly seems useless, but im sure someone out there might need this

  • 1

10 years ago

Posts: 2014

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

Thanks to your library I just learned knowledge about Lua tables lmao

 

Anyways, vouch, cool release

  • 1

Random quote here...

Posts: 283

Threads: 48

Joined: May, 2022

Reputation: -4

Replied

@child1010

 

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.

  • 0

https://media.discordapp.net/attachments/1044764388546068510/1051935933836050482/Signature_4.png

Posts: 190

Threads: 19

Joined: Jul, 2021

Reputation: 6

Replied

@luxiferrwoo oh sorry, i meant to say it was useless to me personally.

  • 0

10 years ago

Posts: 136

Threads: 21

Joined: Mar, 2022

Reputation: -2

Replied

nice very cool

  • 0

exploits i use: kiwi x

Entity

Usability >> modern

vip

Posts: 416

Threads: 40

Joined: May, 2022

Reputation: 51

Replied

epic epic :vouch:

  • 0

Nolix

use vantra hub

Posts: 436

Threads: 61

Joined: Mar, 2022

Reputation: 14

Replied

jesus christ please switch the lib to github lol

  • 0

Added

@atari ah rip, hope he can get it fixed

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )