Storage Functions

Aus EEP Handbuch
Version vom 7. September 2018, 14:01 Uhr von Marc Horstmann (Diskussion | Beiträge)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche
EEPSaveData() EEPSaveData(Slot,Value|"String"|Boolean|nil)
type: function
    EEPSaveData(1, 42)                   -- store value
    EEPSaveData(2, "I am slot 2")        -- store string
    EEPSaveData(3, true)                 -- store boolean
    EEPSaveData(4, nil)                  -- delete
                
caller: script
defined in: EEP
parameters: two
returns: one
requires: EEP 11.0
purpose: Permanent data storage. The saved data is stored in the same file as the user’s Lua program but isn’t visible in the EEP Lua editor. Prevents data loss when script is re-loaded
notes:
  • Provides a means for the Lua code to store data in slots that are numbered 1 to 1000. Each slot may contain a numeric, string or Boolean value. Strings must not containformatting characters (e.g. quotes).
  • First argument is the slot ID
  • Second argument is the data to be stored. Delete slot by assigning nil to it.
  • Return value is true when storing was successful (i.e. target slot found), else false.
  • Each slot is written to using the EEPSaveData() function and read from using the EEPLoadData() function. The current value of each slot will also be saved with the user’s Lua program when the layout is saved. This will maintain sync between layout condition and data. The section of the script containing this data is not visible in EEP’s Lua editor.


EEPLoadData() EEPLoadData(Slot)
type: function
    hResult, hData = EEPLoadData(1)
    if hResult then 
        print("Slot 1 contains: "..hData)
    else
        print("Slot 1 is empty")
    end
                
caller: script
defined in: EEP
parameters: one
returns: two
requires: EEP 11.0
purpose: Loads contents from data slot. Use this function to restore data when you re-load your script.
notes:
  • Provides a means for the Lua code to read data from slots that are numbered 1 to 1000.
  • Each slot may contain a numeric, string or Boolean value. Strings must not contain formatting characters (e.g. quotes).
  • Argument is the slot ID.
  • First return value is true, if the slot contains data, else false.
  • Second return value is the data contained in this slot.
  • Slot data is transferred from the script to memory when a layout is loaded.