lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] wrote:
*I am working since a few days with the program FEMM and I am not very familiar with the scripting language lua. I have a little problem: I wrote a quite big lua script file and want to split it into multiple little lua script files in order to make it more orderly. But how? Here my questions:
- If possible, how can I call  another lua script file?
- Which format (.lua?) must these multiple lua script files have?
-Do they have to be in the same directory as the calling lua script file?
**Thanks for your answer!

I support you are talking about this program: Finite Element Method Magnetics <>, as the features mention Lua scripting.

I don't know this implementation, but in standard Lua, the classical way of calling another Lua script file is to use dofile[[Path/of/script]]. If the scripts are in the same directory, no need for path. Otherwise, you can specify relative or absolute path.
Which format? Plain Lua files, or bytecode generated by LuaC.

For finer control, you may want to look at loadfile, pcall, require, unless FEMM is using Lua 4.0 or lower. See the Lua doc.

Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist