From: Hans Hagen <j.hagen@xs4all.nl>
To: ntg-context@ntg.nl
Subject: [NTG-context] Re: Lua question - table.save, table.load
Date: Sat, 11 Jan 2025 17:48:35 +0100 [thread overview]
Message-ID: <b49619cd-a9ce-487e-aa34-14781b41cf53@xs4all.nl> (raw)
In-Reply-To: <3D77A83F-3238-411E-BE8D-218EC4185D00@mac.com>
On 1/11/2025 4:01 PM, Jeong Dal via ntg-context wrote:
> 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?
so you add to that list?
-----------------------------------------------------------------
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
___________________________________________________________________________________
next prev parent reply other threads:[~2025-01-11 16:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 15:01 [NTG-context] " Jeong Dal via ntg-context
2025-01-11 16:48 ` Hans Hagen [this message]
2025-01-11 21:10 ` [NTG-context] " Jeong Dal via ntg-context
2025-01-12 11:00 ` Jeong Dal via ntg-context
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b49619cd-a9ce-487e-aa34-14781b41cf53@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).