ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Lua question - table.save, table.load
@ 2025-01-11 15:01 Jeong Dal via ntg-context
  2025-01-11 16:48 ` [NTG-context] " Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Jeong Dal via ntg-context @ 2025-01-11 15:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jeong Dal


[-- Attachment #1.1: Type: text/plain, Size: 809 bytes --]

Dear all,

I save a table “tfList” using table.save in Lua:

\startluacode
	...
	table.save(“tempList.lua”,tfList)
	...
\stopluacode

And I call it in MetaFun using a method explained in the MetaFun book.

\startMPcode
lua("MP = { } MP.data = table.load('tempList.lua')") ;
…
\stopMPcode

However, I found that whenever I save “tfList”, table contents are appended to the file “tempList.lua” at the end which cause a trouble.
I want the tempList.lua contains the new table only.
I search the method to do that, but I can’t find it.
The only way is to change the file name each time which is not good to make a macro.

Is there a way to clear the contents in the tempList.lua before I save another table?

 Thank you for reading.

Best regards,

Dalyoung




[-- Attachment #1.2: Type: text/html, Size: 2629 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-12 11:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-11 15:01 [NTG-context] Lua question - table.save, table.load Jeong Dal via ntg-context
2025-01-11 16:48 ` [NTG-context] " Hans Hagen
2025-01-11 21:10   ` Jeong Dal via ntg-context
2025-01-12 11:00   ` Jeong Dal via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).