Logic Machine Forum
memory size for files created by script - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: memory size for files created by script (/showthread.php?tid=2559)



memory size for files created by script - SigmaTec - 02.04.2020

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.


RE: memory size for files created by script - admin - 02.04.2020

Please explain what are you trying to do and what kind of data do you want to write into these files.


RE: memory size for files created by script - SigmaTec - 02.04.2020

I want to save, in a simple way, in a file, (without sql for example) the variations of values ​​of objects of type "string".


RE: memory size for files created by script - admin - 02.04.2020

What is the purpose of this, what do you want to do with this file?


RE: memory size for files created by script - SigmaTec - 02.04.2020

to use it as a log file I can link to an e-mail for example.


RE: memory size for files created by script - Daniel - 02.04.2020

Why don't you use storage?


RE: memory size for files created by script - SigmaTec - 02.04.2020

because i have a lot of small strings to record :
12 shorts strings even 10 seconds, during 30 days...


RE: memory size for files created by script - admin - 02.04.2020

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.


RE: memory size for files created by script - SigmaTec - 02.04.2020

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)?


RE: memory size for files created by script - admin - 02.04.2020

Yes, LM uses a microSD card internally. As for USB, have a look at this: https://forum.logicmachine.net/showthread.php?tid=678


RE: memory size for files created by script - SigmaTec - 02.04.2020

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?


RE: memory size for files created by script - admin - 02.04.2020

Depends on what kind of data you want to record. "shorts strings" does not say much.