-4

To Zerobrane users, since this is not a question on lua :

I use Zerobrane for editing lua programs that are to be used with LuaLatex. Very nice !

I make all tests there before using the developments in LuaLatex. So, at the beginning, the programs are run there. I need to tidy up this part, on ZeroBrane, by making files hierarchical, with a master file and slave files around.

Once again, it is a question about ZeroBrane, not about how I use the file within LuaLatex (I know enough about doFile, luaexec and co)

Does this exist ?

I saw PaulK passing by, if he could drop a line, it would be appreciated ...

user1771398
  • 475
  • 6
  • 18

1 Answers1

1

An "include mechanism" as you call it is usually a language feature, not some feature of an IDE.

Lua provides various functions for running code from other files. dofile, load, loadfile, require, ...

The most convenient and common is require which will find a file by its name in a given set of directories and execute its contents.

Read this: https://www.lua.org/manual/5.3/manual.html#6.3

https://www.lua.org/pil/8.1.html

https://www.tutorialspoint.com/lua/lua_modules.htm

Piglet
  • 27,501
  • 3
  • 20
  • 43
  • I could multiply "require"s but I would prefer to have a unique and structured source file, if this is possible like in TexMaker editor for instance where you can have master and slave documents. – user1771398 Oct 02 '16 at 08:09
  • @user1771398 I don't understand what you want. So using require commands in your "master file" is no option? you run a skript that can run code from other files which again can run code from other files. So you have everything you need to organize your code across multiple files. What is your problem? – Piglet Oct 02 '16 at 09:35
  • I wish I can have a single lua file visible from the many LaTeX documents that use it. It is some kind of a library for LaTeX files. I wish to hide from the user the complexity and organization of the lua library. But if you can be positive to say that there is no mechanism for that, that's fine. – user1771398 Oct 02 '16 at 14:01
  • I still don't understand why you don't want to use require commands. You run one Lua script that may include code from many other Lua files. Isn't that exactly what you want? I don't get it – Piglet Oct 02 '16 at 14:53
  • An example : when I test alone (away from the LaTeX context) the different lua modules, when files are apart, they cannot see the primitive of the other modules. Today, I am obliged to have a single big file with all the lua stuff. I would prefer to have this big file split in modules. – user1771398 Oct 02 '16 at 16:58
  • then why don't you create your own modules which you then use with the require statement. maybe you should read more about lua modules so you will understand – Piglet Oct 02 '16 at 18:03