Lua Test MFD v 0.1.1
UNTESTED ALPHA for technical demonstration only. Has very limited actual use.
v0.1.1 update: Removed old header file references.
This is a sample MFD add-on for Orbiter to show simple LUA script integration.
Sample use:
1) Run a scenario (Checklist | Mission 1 - DG to ISS) and open the Lua Test MFD
2) There is one button labeled INPT. This triggers a popup for console input. One line of LUA is read and run at a time.
Results of running the line of script are shown on the MFD display as well as the debug output.
3) Press INPT and type:
print("hello world")
As you would expect, "Hello world" will display on the MFD and debug output.
4) INPT:
f = loadfile("lua.txt")
5) INPT:
f()
Step 4 loads the lua.txt file, which should have ended up in your root orbiter directory. The file itself is assigned to the function f(), but not yet executed.
Step 5 executes the loaded contents of the file. At this point the functions the file defines are defined, and any "loose" code is executed. The default file defines go() and stop() functions, which start and stop the main engine. It also calls the go() function in loose code. The variable "i" is also initialized to the focus vessel's interface, and the variable "p" is initialized as a shortcut to print.
Default lua.txt shown in screenshot.