Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("/ccConfig")
- local config = ccConfig.new("config.cfg", "Resetting a Config")
- local running
- local function loadConfig()
- config:load()
- running = config:getBoolean("canRun", true) -- put this value in the config after first run "thisCausesError"
- config:save()
- return true
- end
- local ok, err = pcall(loadConfig)
- if not ok then
- print("Error ->"..err) -- tell the user what they did wrong
- config:reset() -- this resets the configs back to the default values you provide, of course if it an error in your defaults this will do nothing, its mainly for when you have an error in the config caused by the users
- config:save() -- save the defaults out to file
- loadConfig() -- call our load again, this should work fine now unless its a problem with your defaults
- end
- print("This should display whats in the configs:")
- print("canRun: "..tostring(running)) --> whats in config or false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement