Difference between revisions of "Settings.unset"
From ComputerCraft Wiki
Bomb Bloke (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=settings.unset |args={{Type|string}} setting |api=settings |addon=ComputerCraft |desc=Removes a setting from the currently loaded set. If you wi...") |
Bomb Bloke (Talk | contribs) |
||
Line 5: | Line 5: | ||
|api=settings | |api=settings | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc=Removes a setting from the currently loaded set. If you wish to unload all settings, refer to [[settings.clear]](). | + | |desc=Removes a setting from the currently loaded set. If you wish to unload all settings, refer to [[settings.clear]]().<br><br> |
+ | |||
+ | Note that when the system reboots, first the [[Settings_(API)#Default_Settings|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. | ||
|examples= | |examples= | ||
{{Example | {{Example |
Latest revision as of 03:13, 10 June 2016
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
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() ) |
Settings API Functions |
---|
settings.set - settings.get - settings.unset - settings.clear - settings.getNames - settings.load - settings.save |