-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of file.savedump(filename, func [, striplevel]) #3145
Comments
Is I think I would advocate for this to be |
OK, your suggestion of putting this function in file works well, but given that we can only have one top level function per undump, I think that this better a file.savedump(filename, func [, striplevel]) |
I wonder... given that you have made a lovely |
This is more a case of using the right tool for the job. We needed the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Don't close |
Missing feature
file.putcontents(filename, string.dump(func))
is a simple method of copying a given in-RAM or in-LFS function to an LC file in SPIFFS, however thestring.dump()
C code doesand at peak this generates three copies of the function in memory:
Proto
hierarchyluaL_Buffer
chunks on the Lua stackThis is approach is fine PC class environments but we only have ~40Kb RAM and this limits the size of function we can dump. If we use a writer that sends directly to file, then we don't need the extra RAM to store the 2 copies of the full dump.
The main use of this function is to allow developers to dump LFS functions to LC files for #2917.
Note:
node
function, this would be available in both the Lua 5.1 and 5.3 environments.striplevel
parameter tonode.compile()
as well.Justification
To remove an unnecessary RAM constraint is dumping in-RAM or in-LFS functions.
Workarounds
file.putcontents(filename, string.dump(func))
only works for function with dumps less than 15Kb or so. No workarounds for functions larger than this.The text was updated successfully, but these errors were encountered: