Module config
Functions for saving/loading config data
This module is a lua script (config.lua), you need to explicitly load it
with require('config')
Functions
create (default) | Create a new config instance, filename will be determined automagically |
Class config
config.data | Get/Set the data to store to configuration |
config:create_from_menu (m) | Create a new config instance from a menu structure, filename will be determined automagically |
config:load () | Load the config data from file (by executing the file) |
config:saving () | Called right before config data is saved to file, override this function to update your config.data when the config is being saved |
config:save () | Manually save the config data to file (data is saved automatically when the ML backend does it's config saving, so calling this function is unecessary unless you want to do a manual save). |
Functions
- create (default)
-
Create a new config instance, filename will be determined automagically
Parameters:
- default the default data values
Class config
- config.data
-
Get/Set the data to store to configuration
- data
- config:create_from_menu (m)
-
Create a new config instance from a menu structure, filename will be determined
automagically
Parameters:
- m the menu to create a config for
- config:load ()
- Load the config data from file (by executing the file)
- config:saving ()
- Called right before config data is saved to file, override this function to update your config.data when the config is being saved
- config:save ()
- Manually save the config data to file (data is saved automatically when the ML backend does it's config saving, so calling this function is unecessary unless you want to do a manual save). Whatever is in the 'data' field of this instance is saved. Only numbers, strings and tables can be saved (no functions, threads or userdata)