In this case you can separately add elements to setup, but the way of accessing certain regions will change.
local m_rage = {
switch = pui.switch("Rage", "Enable"),
}
local m_visuals = {
enable = pui.switch("Visuals", "Enable"),
chams = {
color = pui.color_picker("Visuals", "Color"),
}
}
local m_misc = {
combo = pui.combo("Misc", "Combo", {"A", "B", "C"}),
}
pui.setup({m_rage, m_visuals, m_misc})
pui.save(1) -- only save m_rage
pui.save(2, "chams") -- only save m_visuals > chams
Everything's ready. Now you can save and load your configs.
Keep in mind that any changes to your table may affect the config system and, therefore, old configs will lose some of the information (or even lose it all)
pui ignores non-existing regions of configs.
Saving and loading
When you have set the config system up, you can use it easily.
pui.save(...) : table
As you can see, this function will return a table of values. This table is identical to the original table of elements.
local config = pui.save()
Done.
You may also want to serialize and encrypt it:
local encrypted = base64.encode( json.stringify(config) )
... is a path to a certain region of your table. For example, you want to only save rage region of your elements. In this case, it will look like this:
pui.save("rage")
It also supports nested tables. For example:
pui.save("antiaim", "antibrute", "general")
pui.load(config, ...)
There is nothing complicated as well.
Don't forget to decrypt and parse the data. pui.load() only accepts a table created with pui.save().
local config = pui.save()
pui.load(config)
local encrypted = base64.encode( json.stringify(config) )
local decrypted = json.parse( base64.decode(encrypted) )
pui.load(decrypted)
... is a path to a certain region of your table. For example, you want to only load rage region of your elements. In this case, it will look like this:
pui.load(config, "rage")
It also supports nested tables. Just like pui.save()
Packages - Isolated config system
This is a much better way to use the config system in pui, as it won't be affected by other scripts and can be created multiple times.
You can create several config systems, but that is superfluous, since you can just define regions to save and load.
Creating
neverlose
local package = pui.setup(menu, true)
gamesense
local package = pui.setup(menu)
Saving and loading
config:save(...) : table
As you can see, this method will return a table of values. This table is identical to the original table of elements.
local config = pui.setup(menu)
local data = config:save()
Done.
You may also want to serialize and encrypt it:
local encrypted = base64.encode( json.stringify(data) )
... is a path to a certain region of your table. For example, you want to only save rage region of your elements. In this case, it will look like this:
config:save("rage")
It also supports nested tables. For example:
config:save("antiaim", "antibrute", "general")
config:load(data, ...)
There is nothing complicated as well.
Don't forget to decrypt and parse the data. :load() only accepts a table created with :save().
local config = pui.setup(menu)
local data = config:save()
config:load(data)
local encrypted = base64.encode( json.stringify(data) )
local decrypted = json.parse( base64.decode(encrypted) )
config:load(decrypted)
... is a path to a certain region of your table. For example, you want to only load rage region of your elements. In this case, it will look like this: