Our Lua engine, Kerbalua, uses a modified version of MoonSharp to create an in-game Lua scripting environment for KSP.

Since MoonSharp is a lua implementation that can interact with CLR/C# objects, and since KSP is implemented in C#, our engine can interact with any aspect of the the KSP Api ingame. We can provide, in in-game scripting, nearly any functionality a modmaker would normally have to access with C#.

How to make and use modules:

It can be hard to do much without confusion if you are putting all your files in one folder. In the current way Kerbalua works, your files are in the Scripts directory. But you can put folders in there and add files in them if you want to make less clutter. Currently, there is no way to use LiveRepl to navigate to those folders, but you can put files in them which can be loaded as modules into scripts.

For more info on Lua Modules, see this section of the Lua manual

To edit those library files you can use an external file editor.

Lua Missing Features:

If you really want any of these features, let me (Evan/evandisoft) know and I’ll consider trying to implement a version that works with our project.

require can be used, as I was able to specify the paths that are to be used to search for libs. require will only run something the first time you call it on some filepath. To make it run that file again again you have to do packages[filepath]=nil.

API

In addition to the Common API, Kerbalua has some functionality specific to it: Kerbalua API.

For basic information about Lua there is lots of documentation available online. The version MoonSharp uses is 5.2.

Here are some tutorials specific to KSP functionality.

Totorials/Guides