Module luasettings

This module handles generic settings as well as KOReader's global settings system.

Functions

LuaSettings:open (file_path) Opens a settings file.
LuaSettings:child (key) Reads child settings.
LuaSettings:readSetting (key) Reads a setting.
LuaSettings:saveSetting (key, value) Saves a setting.
LuaSettings:delSetting (key) Deletes a setting.
LuaSettings:has (key) Checks if setting exists.
LuaSettings:hasNot (key) Checks if setting does not exist.
LuaSettings:isTrue (key) Checks if setting is true.
LuaSettings:isFalse (key) Checks if setting is false.
LuaSettings:nilOrTrue (key) Checks if setting is nil or true.
LuaSettings:nilOrFalse (key) Checks if setting is nil or false.
LuaSettings:flipNilOrTrue (key) Flips nil or true to false.
LuaSettings:flipNilOrFalse (key) Flips nil or false to true.
LuaSettings:flipTrue (key) Flips setting to true.
LuaSettings:flipFalse (key) Flips setting to false.
LuaSettings:reset (table) Replaces existing settings with table.
LuaSettings:flush () Writes settings to disk.
LuaSettings:close () Closes settings file.
LuaSettings:purge () Purges settings file.


Functions

LuaSettings:open (file_path)
Opens a settings file.

Parameters:

  • file_path
LuaSettings:child (key)
Reads child settings.

Parameters:

  • key

Usage:

    Settings:saveSetting("key", {
        a = "b",
        c = "true",
        d = false,
    })
    
    local child = Settings:child("key")
    
    child:readSetting("a")
    -- result "b"
LuaSettings:readSetting (key)
Reads a setting.

Parameters:

  • key
LuaSettings:saveSetting (key, value)
Saves a setting.

Parameters:

  • key
  • value
LuaSettings:delSetting (key)
Deletes a setting.

Parameters:

  • key
LuaSettings:has (key)
Checks if setting exists.

Parameters:

  • key
LuaSettings:hasNot (key)
Checks if setting does not exist.

Parameters:

  • key
LuaSettings:isTrue (key)
Checks if setting is true.

Parameters:

  • key
LuaSettings:isFalse (key)
Checks if setting is false.

Parameters:

  • key
LuaSettings:nilOrTrue (key)
Checks if setting is nil or true.

Parameters:

  • key
LuaSettings:nilOrFalse (key)
Checks if setting is nil or false.

Parameters:

  • key
LuaSettings:flipNilOrTrue (key)
Flips nil or true to false.

Parameters:

  • key
LuaSettings:flipNilOrFalse (key)
Flips nil or false to true.

Parameters:

  • key
LuaSettings:flipTrue (key)
Flips setting to true.

Parameters:

  • key
LuaSettings:flipFalse (key)
Flips setting to false.

Parameters:

  • key
LuaSettings:reset (table)
Replaces existing settings with table.

Parameters:

  • table
LuaSettings:flush ()
Writes settings to disk.
LuaSettings:close ()
Closes settings file.
LuaSettings:purge ()
Purges settings file.
generated by LDoc 1.4.6 Last updated 2017-08-17 09:26:49