Posts: 169
Threads: 58
Joined: Oct 2017
Reputation:
0
Hi all,
I would like to know the maximum memory size available if I want to create files with the Lua functions "io.open/write".
Then, in what default directory will these files be created, and how can I specify another one?
Thank's in advance fior your help.
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
Please explain what are you trying to do and what kind of data do you want to write into these files.
Posts: 169
Threads: 58
Joined: Oct 2017
Reputation:
0
I want to save, in a simple way, in a file, (without sql for example) the variations of values of objects of type "string".
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
What is the purpose of this, what do you want to do with this file?
Posts: 169
Threads: 58
Joined: Oct 2017
Reputation:
0
to use it as a log file I can link to an e-mail for example.
Posts: 4646
Threads: 24
Joined: Aug 2017
Reputation:
207
Why don't you use storage?
------------------------------
Ctrl+F5
Posts: 169
Threads: 58
Joined: Oct 2017
Reputation:
0
because i have a lot of small strings to record :
12 shorts strings even 10 seconds, during 30 days...
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
If each string is 20 bytes long then your whole log will be at least 60MB in size. Most probably you won't be able to send that using e-mail.
As for writing into files you should not write to SD card often as it can quickly kill it. One solution is to write to a temporary file then move it to SD by the end of the day by using a scheduled script. There's a slight disadvantage that this file can be lost if the device is rebooted. You should also take care of deleting old log files.
Posts: 169
Threads: 58
Joined: Oct 2017
Reputation:
0
Ok, thanks for the reply on the file size: I will therefore only send the useful records by e-mail (error reports in my case), after the complete file.
The SD card you are talking about is internal to the LM?
If yes :
I was just thinking of using a USB key to save the log file, to avoid using too much internal memory.
Do you have an example script that copies a file to an USB key (I don't know this point on LM)?
Posts: 169
Threads: 58
Joined: Oct 2017
Reputation:
0
02.04.2020, 14:08
(This post was last modified: 02.04.2020, 14:09 by SigmaTec.)
ok, many thank's, I will try this.
Do you think it would be better for me to use an SQL database for recording my data?
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
Depends on what kind of data you want to record. "shorts strings" does not say much.