On 8/10/2025 12:01 PM, Hraban Ramm wrote:

Am 10.08.25 um 11:41 schrieb Wolfgang Schuster:
Am 10.08.2025 um 11:33 schrieb Hraban Ramm:
Hi again,

for caching some generated data, I’d like to save a nested Lua table to a file, and load it later.

I found http://lua-users.org/wiki/SaveTableToFile

Is there already something (better) in ConTeXt? I'd assume, since the functionality is needed for tuc files?

table.tofile("my_file.lua",my_table)

Thank you, I overlooked that in cld-mkiv, since I was looking for table.save (which was mentioned in a thread about Ecir Baff’s art).

And for reading context.runfile, right? What does it better than Lua’s dofile?

You don't tell what you want to do with the file

table.save("my_file.lua",my_table)
my_table = tabel.load("my_file.lua")

wrt runfiles benefits:

- finding the file
- checking it
- reporting on it


Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to