The easiest way I've found is to have a function (or more likely, a bunch of functions) that:
1. Grabs the values from every important GUI element and tosses them in a table.
2. Saves that table to a text file in whatever format you want. I actually found a neat function that writes it as legal Lua code, which is handy for the next step.
3. Loads the text file and transfers the data back into a table.
4. Goes through each value in the table and applies it to the appropriate GUI element.
That's how Radial Menu does it, and I've found it to be really useful. See the functions save_menu and load_menu for a starting point.
I should also note that every GUI element's input methods have been modified so they store their values in mnu_arr automatically, and there are a number of functions (i.e. update_context_elms that just copy values from the table to the elements at various points.
From there, a preset system would just need to save them to different files, or somehow segregate them within one file - perhaps with named comments so the loader could search for names and then only read that portion of the file.
|