Peakboard boards are scripted in Lua, and the runtime is a .NET application. The piece that connects the two is MoonSharp, a Lua interpreter written in C#. Picking the interpreter was the easy decision. The surface between the two languages was not.
Lua is small, it was made for embedding, and it has been stable for decades. A script written for a board five years ago still runs. The cost is real too: indexing starts at 1, there is one data structure for everything, and nobody arrives already knowing it.
MoonSharp is a .NET assembly, so a script runs in the same process as everything else. No native library, no separate process. A board reads a data source, updates a control and writes back to a machine inside one tick, and none of those steps crosses a boundary.
What it does not do is expose .NET objects on its own, and that is the right default. Every type a script may touch gets a descriptor class, every member is marked visible one at a time, and nothing leaks by accident. That list only ever grows, and it exists more than once: the designer needs the surface for validation, completion and mock data, each runtime needs it to execute, and when the two drift a script passes on someone’s desk and fails on the wall.
The conversions are where the time goes. Lua has one number type and .NET has the rest of the world, so an integer, a decimal and a long all arrive as the same Lua number, and the way back is guesswork. A generic list and a non-generic list are not interchangeable, an enumerable is not indexable at all, and a data source hands back whatever its own layer produces, so every collection has to be normalised into something that can answer two questions: how many items, and give me item n.
Data rows have no fixed shape at all. Their columns come from a query the board author wrote, so there is no class to describe and the lookup happens while the script runs. A missing column returns nil instead of taking the board down, which matters when the screen is on a factory wall at three in the morning.
That’s it.
If you have questions feel free to contact me.
Links:
MoonSharp →
Lua reference manual →
Peakboard scripting documentation →