Config system

Yes, you can do that too

Basic config system

This is probably the easiest way to set up a config system.

local menu = {
    enable = pui.switch("General", "Master")
    rage = {
        switch = pui.switch("Rage", "Enable"),
    },
    visuals = {
        color = pui.color_picker("Group", "Color"),
    },
    misc = {
        combo = pui.combo("Group", "Combo", {"A", "B", "C"}),
    }
}

pui.setup(menu)

Everything's ready. Now you can save and load your 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.

Done.

You may also want to serialize and encrypt it:

pui.load(config, ...)

There is nothing complicated as well.

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

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.

Done.

You may also want to serialize and encrypt it:

config:load(data, ...)

There is nothing complicated as well.

Last updated