Difference between revisions of "Settings.load"
From ComputerCraft Wiki
Bomb Bloke (Talk | contribs) m (Type templates) |
Bomb Bloke (Talk | contribs) m (Code fix.) |
||
(One intermediate revision by the same user not shown) | |||
Line 8: | Line 8: | ||
|desc=Loads settings from the specified file. Any settings that've already been loaded (eg [[Settings_(API)#Default_Settings|the defaults]]) will not be affected unless the target file contains entries with the same names.<br><br> | |desc=Loads settings from the specified file. Any settings that've already been loaded (eg [[Settings_(API)#Default_Settings|the defaults]]) will not be affected unless the target file contains entries with the same names.<br><br> | ||
− | If a file titled ".settings" is [[settings.save|saved]] to the root of a computer's drive, it will be automatically loaded on startup (without need to call this function manually). | + | If a file titled ".settings" is [[settings.save|saved]] to the root of a computer's drive, it will be automatically loaded on startup after the default settings (without need to call this function manually). |
|examples= | |examples= | ||
{{Example | {{Example | ||
Line 17: | Line 17: | ||
settings.load("mySettings") | settings.load("mySettings") | ||
− | print(" | + | print("\nResulting loaded settings:\n") |
[[textutils.pagedTabulate]]( [[settings.getNames]]() ) | [[textutils.pagedTabulate]]( [[settings.getNames]]() ) | ||
}} | }} |
Latest revision as of 03:14, 10 June 2016
Function settings.load | |
Loads settings from the specified file. Any settings that've already been loaded (eg the defaults) will not be affected unless the target file contains entries with the same names. If a file titled ".settings" is saved to the root of a computer's drive, it will be automatically loaded on startup after the default settings (without need to call this function manually). | |
Syntax | settings.load(string path) |
Returns | boolean success |
Part of | ComputerCraft |
API | settings |
Examples
Example | |
Loads all settings specified within the file "mySettings", displaying before / after lists. | |
Code |
print("Initial loaded settings:\n") textutils.pagedTabulate( settings.getNames() ) settings.load("mySettings") 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 |