Settings API

From ComputerCraft
Jump to navigation Jump to search
,
FunctionFunctionsettings.clear
Remove all settings.
Syntax settings.clear()
Returns nil
Part of CC:Tweaked (source)
API settings
ExampleExampleRemove all settings
Remove all settings.
Code
settings.clear()


,
FunctionFunctionsettings.copy
Returns the value of a setting.
Syntax settings.copy()
Returns any value
Part of CC:Tweaked (source)
API settings
ExampleExampleGet the value of a setting
Get the value of the setting "shell.autocomplete" and print it.
Code
print(settings.copy("shell.autocomplete"))
Output
true


,
FunctionFunctionsettings.get
Returns the value of a setting. If the setting doesn't exists, the second argument will be returned.
Syntax settings.get()
Returns any value
Part of CC:Tweaked (source)
API settings
ExampleExampleGet the value of a setting
Get the value of the setting "shell.autocomplete" and print it.
Code
print(settings.get("shell.autocomplete"))
Output
true


FunctionFunctionsettings.getNames
Get a list of all settings.
Syntax settings.getNames()
Returns table
Part of CC:Tweaked (source)
API settings
ExampleExampleGet a List of all settings
Get a List of all settings and print it.
Code
for k,v in ipairs(settings,getNames()) do
  write(v.." ")
end
Output bios.use_multishelledit.autocompleteedit.default_extensionlist.show_hiddenlua.autocompletepaint.default_extensionshell.allow_disk_startupshell.allow_startupshell.autocomplete


,
FunctionFunctionsettings.load
Load the settings from a File.
Syntax settings.load()
Returns boolean success
Part of CC:Tweaked (source)
API settings
ExampleExampleLoad the settings from a file
Load the settings from ".settings".
Code
settings.load(".settings")


,
FunctionFunctionsettings.save
Save the settings into a file.
Syntax settings.save()
Returns boolean success
Part of CC:Tweaked (source)
API settings
ExampleExampleSave the settings into a file
Save the settings into ".settings".
Code
settings.save(".settings")


,
FunctionFunctionsettings.set
Set the value of a setting.
Syntax settings.set()
Returns nil
Part of CC:Tweaked (source)
API settings
ExampleExampleSet the value of a setting
Set the value of the setting "shell.autocomplete" to false.
Code
settings.set("shell.autocomplete",false)


,
FunctionFunctionsettings.unset
Remove a specific setting.
Syntax settings.unset()
Returns nil
Part of CC:Tweaked (source)
API settings
ExampleExampleRemove a setting
Remove "edit.autocomplete".
Code
settings.unset("edit.autocomplete")