Settings API

,

Functionsettings.clear
Remove all settings.
Syntax settings.clear()
Returns nil
Part of CC:Tweaked (source)
API settings
ExampleRemove all settings
Remove all settings.
Code
<nowiki>settings.clear()</nowiki>

,

Functionsettings.copy
Returns the value of a setting.
Syntax settings.copy(
  • name : string
)
Returns any value
Part of CC:Tweaked (source)
API settings
ExampleGet the value of a setting
Get the value of the setting "shell.autocomplete" and print it.
Code
<nowiki>print(settings.copy("shell.autocomplete"))</nowiki>
Output
true

,

Functionsettings.get
Returns the value of a setting. If the setting doesn't exists, the second argument will be returned.
Syntax settings.get(
  • name : string
  • default : any
)
Returns any value
Part of CC:Tweaked (source)
API settings
ExampleGet the value of a setting
Get the value of the setting "shell.autocomplete" and print it.
Code
<nowiki>print(settings.get("shell.autocomplete"))</nowiki>
Output
true
Functionsettings.getNames
Get a list of all settings.
Syntax settings.getNames()
Returns table
Part of CC:Tweaked (source)
API settings
ExampleGet a List of all settings
Get a List of all settings and print it.
Code
<nowiki>
for k,v in ipairs(settings,getNames()) do
  write(v.." ")
end
  </nowiki>
Output bios.use_multishelledit.autocompleteedit.default_extensionlist.show_hiddenlua.autocompletepaint.default_extensionshell.allow_disk_startupshell.allow_startupshell.autocomplete

,

Functionsettings.load
Load the settings from a File.
Syntax settings.load(
  • path : string
)
Returns boolean success
Part of CC:Tweaked (source)
API settings
ExampleLoad the settings from a file
Load the settings from ".settings".
Code
<nowiki>settings.load(".settings")</nowiki>

,

Functionsettings.save
Save the settings into a file.
Syntax settings.save(
  • path : string
)
Returns boolean success
Part of CC:Tweaked (source)
API settings
ExampleSave the settings into a file
Save the settings into ".settings".
Code
<nowiki>settings.save(".settings")</nowiki>

,

Functionsettings.set
Set the value of a setting.
Syntax settings.set(
  • name : string
  • value : any
)
Returns nil
Part of CC:Tweaked (source)
API settings
ExampleSet the value of a setting
Set the value of the setting "shell.autocomplete" to false.
Code
<nowiki>settings.set("shell.autocomplete",false)</nowiki>

,

Functionsettings.unset
Remove a specific setting.
Syntax settings.unset(
  • name : string
)
Returns nil
Part of CC:Tweaked (source)
API settings
ExampleRemove a setting
Remove "edit.autocomplete".
Code
<nowiki>settings.unset("edit.autocomplete")</nowiki>
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.