Storage module API (require “storage”)
, , ,
- Get <value from storage with corresponding key.
- Put bool value to storage with corresponding key
- Put string value to storage with corresponding key
- Put number value to storage with corresponding key
				
				Edit
			
			- params: key – string, value – number
- Note, lua has ‘number’ type but it can can be in integer state. The difference between states are in conversion to string and printing. saves value in integer state if possible. See example for details.
- return: none
				
				Edit
			
			
				
					require "storage"
storage.set_number("ItemsCount", 50)
print(storage.get_number("ItemsCount")) -- output: 50
storage.set_number("Pi", 3.14159)
print(storage.get_number("Pi")) -- output: 3.14159
storage.set_number("AverageTemperature", 20.0)
print(storage.get_number("AverageTemperature")) -- output: 20 (not 20.0)				
			
            - Put table value to storage with corresponding key
				
				Edit
			
			- params: key – string, value – table
- Supported table key types: string, number, bool Supported table value types: string, number, bool, table. Number values are saved as integer if possible (see for details).
- Note, recurse tables and metatables are not supported.
- return: none
				
				Edit
			
			
				
					require "storage"
storage.set_table("ItemData", {
        name = "xyz",
        type = "switch"
    })
storage.set_table("SomeData", {
        name = "xyz",
        [1] = true,
        [3] = false,
        [true] = {
            [1.1] = 7
        }
    })
local result = storage.get_table("SomeData")
print(result.name)       -- output: xyz
print(result[1])         -- output: true
print(result[true][1.1]) -- output: 7 				
			
            - Check if key is set.
- Delete value from storage marked with key. Function has no effect if key does not exist.
- Clear storage. Deletes all key/value pairs from current volume
 
                                    