Hello, at the risk of this being the wrong address: can I edit and run Lua with TeXShop? Does anyone have experience with this? Or what could be used as an IDE for Lua? Greetings Thomas
On 10/8/2024 12:35 PM, Thomas Meyer wrote:
Hello,
at the risk of this being the wrong address: can I edit and run Lua with TeXShop? Does anyone have experience with this? Or what could be used as an IDE for Lua?
depends ... if you can associate a lua suffix: mtxrun --script <filename> will run lua with all relevant context libs preloaded. 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 -----------------------------------------------------------------
Hi, I use TeXShop and it is possible to save a file with a .lua suffix (under « Save as… » you choose the menu File format where it is called Lua script). Then I use ConTeXt to run the lua file… Another possibility is to put your lua file between \startluacode … \stopluacode in a TeX file and then you typeset the TeX file in TeXShop with ConTeXt. But probably this is not what you want to do. Best regards: Otared
On 8 Oct 2024, at 12:35, Thomas Meyer
wrote: Hello,
at the risk of this being the wrong address: can I edit and run Lua with TeXShop? Does anyone have experience with this? Or what could be used as an IDE for Lua?
Greetings Thomas ___________________________________________________________________________________ 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 ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95
Hello Hans and Otared, thank you for your answers. Context can run Lua. The output then ends up somewhere in the console output between the other specifications. LuaLaTeX can execute Lua. The output is then the only one in the console. Console output was not what I wanted. However, I was naive enough to hope that the output would be in TeXShop, but that only works with pdf I think. So I am still a little helpless. Greetings Thomas Am 08.10.24 um 19:12 schrieb Otared Kavian:
Hi,
I use TeXShop and it is possible to save a file with a .lua suffix (under « Save as… » you choose the menu File format where it is called Lua script). Then I use ConTeXt to run the lua file… Another possibility is to put your lua file between \startluacode … \stopluacode in a TeX file and then you typeset the TeX file in TeXShop with ConTeXt.
But probably this is not what you want to do.
Best regards: Otared
On 8 Oct 2024, at 12:35, Thomas Meyer
wrote: Hello,
at the risk of this being the wrong address: can I edit and run Lua with TeXShop? Does anyone have experience with this? Or what could be used as an IDE for Lua?
Greetings Thomas ___________________________________________________________________________________ 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 ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com mailto:otared@gmail.com Phone: +33 6 88 26 70 95
___________________________________________________________________________________ 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 ___________________________________________________________________________________
On 9 Oct 2024, at 16:29, Thomas Meyer
wrote: Hello Hans and Otared,
thank you for your answers. Context can run Lua. The output then ends up somewhere in the console output between the other specifications. LuaLaTeX can execute Lua. The output is then the only one in the console. Console output was not what I wanted. However, I was naive enough to hope that the output would be in TeXShop, but that only works with pdf I think. So I am still a little helpless.
If the output went into TeXShop then it would overwrite your Lua program. If you mean have the output go to a file and have TeXShop open that file then maybe just configure TeXShop with an “engine” that runs Lua and sends the output to a .out or .txt file. If you then open the file in a separate TeXShop window, maybe it picks up changes as they happen and displays them? (I haven’t checked for TeXShop but many programming editors can.) I don’t think ConTeXt can run Lua without the output going to the console along with all the initialisation messages. However there is a `lua` command line app to run lua porgrams available from www.lua.org which you could install and use instead. Regards, — Bruce Horrocks Hampshire, UK
On 10/9/2024 6:11 PM, Bruce Horrocks wrote:
On 9 Oct 2024, at 16:29, Thomas Meyer
wrote: Hello Hans and Otared,
thank you for your answers. Context can run Lua. The output then ends up somewhere in the console output between the other specifications. LuaLaTeX can execute Lua. The output is then the only one in the console. Console output was not what I wanted. However, I was naive enough to hope that the output would be in TeXShop, but that only works with pdf I think. So I am still a little helpless.
If the output went into TeXShop then it would overwrite your Lua program.
If you mean have the output go to a file and have TeXShop open that file then maybe just configure TeXShop with an “engine” that runs Lua and sends the output to a .out or .txt file. If you then open the file in a separate TeXShop window, maybe it picks up changes as they happen and displays them? (I haven’t checked for TeXShop but many programming editors can.)
I don’t think ConTeXt can run Lua without the output going to the console along with all the initialisation messages. However there is a `lua` command line app to run lua porgrams available from www.lua.org which you could install and use instead.
If you want the samelua feature sas in context, just mtxrun --script foo.lua is the way to go. (To be sure I cheched if i have lua installed at all and it's some version from 2000; i always use mtxrun because after all luametatex is also a regular lua interpreter) 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 -----------------------------------------------------------------
On 10/9/2024 5:29 PM, Thomas Meyer wrote:
Hello Hans and Otared,
thank you for your answers. Context can run Lua. The output then ends up somewhere in the console output between the other specifications. LuaLaTeX can execute Lua. The output is then the only one in the console. Console output was not what I wanted. However, I was naive enough to hope that the output would be in TeXShop, but that only works with pdf I think. So I am still a little helpless.
Well, context context foo.lua is asking for tex run, not a lua run; what do you expect from foo.lua : context.starttext() context("Hi there") context.stoptext() other than a tex document showing that text. How is luatex to know if you want to typeset or just run tex? So don't take latex as reference. You don't want to start the whole tex machinery to run a lua file, running in luaonly mode is what one needs then. When you have foo.lua : print("Hi there") and want it in the console you run: mtxun --script and here i get this in the console when i hit the "compile" key
mtxrun --script "oeps.lua" Hi There
So you need to figure out in texshop how to relate a run command "mtxrun --script" to a file with suffix ".lua". This approach hasn't changes in the about 20 years that we have luatex. You can ask Dick to add an option like that (specify runner for a lua file) it it's not already there. Hans ps. Of course we can add support for a first line parsing when context sees a .lua file -- mtxrun --script %filename% or just -- runner=mtxrun for editors that lack support for suffix specific runners, but let's first see what texshop can do already. 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 -----------------------------------------------------------------
participants (5)
-
Bruce Horrocks
-
Hans Hagen
-
Hans Hagen
-
Otared Kavian
-
Thomas Meyer