whitecatboard / Lua-RTOS-ESP32

Lua RTOS for ESP32
Other
1.2k stars 221 forks source link

nvs.write(namespace, key, value) do not fully type check the value. #361

Closed chowette closed 4 years ago

chowette commented 4 years ago

Using a value of type table make no error, but next attempt to nvs.read() or nvs.exists() throw a not enough memory exception.

to reproduce:

nvs.write('test','test', {} )
nvs.exists('test','test')

Please note to update the documentation NVS module

diff --git a/NVS-module.md b/NVS-module.md
index 81826dc..324449a 100644
--- a/NVS-module.md
+++ b/NVS-module.md
@@ -41,7 +41,7 @@ Arguments:
 * namespace (string): the namespace to check the key-value pair existence.
 * key (string): the key name to to check.

-Returns: linked value, or an exception.
+Returns: a boolean indicating if the key exist or not.

 ```lua
 nvs.exists("settings","timeout")
@@ -56,7 +56,7 @@ Arguments:
 * namespace (string): the namespace where the key is.
 * key (string): the key name remove in namespace.

-Returns: a boolean indicating if the key has been removed (true), or an exception.
+Returns: a boolean indicating if the key has been removed (true), or not.

 ```lua
 nvs.rm("settings","timeout")