settings.unset

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function settings.unset
Removes a setting from the currently loaded set. If you wish to unload all settings, refer to settings.clear().

Note that when the system reboots, first the default settings will be reloaded, and then (if it exists on the root of the drive) the ".settings" file will also be reloaded. Saving an empty ".settings" file will not in any way affect the loaded defaults - if you want a particular default setting completely cleared on boot, then settings.unset(setting) must be called on startup.
Syntax settings.unset(string setting)
Returns nil
Part of ComputerCraft
API settings

Examples

Grid paper.png  Example
Randomly unsets a setting.
Code
local curSettings = settings.getNames()

print("Initial loaded settings:\n")
textutils.pagedTabulate( curSettings  )

if #curSettings > 0 then settings.unset( curSettings[ math.random( #curSettings ) ] ) end

print("\nResulting loaded settings:\n")
textutils.pagedTabulate( settings.getNames() )


Grid disk.png Settings API Functions
settings.set - settings.get - settings.unset - settings.clear - settings.getNames - settings.load - settings.save