Lua.NET: Integrating Lua with the CLI

Lua is a scripting language not totally unlike Tcl, Perl, or Python. Like Tcl, Lua is an "embedded language", in the sense that embedding the interpreter into your program is a trivial task, and it is very easy to interface Lua with other languages like C, C++, or even Fortran. Like Python, Lua has a clear and intuitive syntax. Like all those three, Lua is an interpreted language with dynamic typing, and with several reflexive facilities.

What sets Lua apart from those languages is its portability, simplicity, and small size. Lua is written in ANSI C, and runs without modifications in almost any platform (MS-DOS, all versions of Windows, all flavors of Unix, plus X-Box, PlayStation II, OS/2, BeOS, EPOC, etc.). The whole program lua.exe has less than 200 Kbytes. Its simplicity led other groups to adopt Lua as a scripting language for other scripting languages (see, for instance, Ruby-Lua).

Currently, Lua has a strong presence whenever programmers need a light, efficient, and portable language. It is being used by some tens of thousands programmers around the world, both in research and in industrial projects. Lua has been successfully used in games (e.g. Grim Fandango, Escape from Monkey Island, MK2, Baldur's Gate), in robots (e.g. Crazy Ivan, that won the Danish RoboCup in 2000 and 2001), and several other applications (e.g. a hot-swappable Ethernet switch (CPC4400), a genetic sequence visualization system (GUPPY), "The most Linux on one floppy disk" (tomsrtbt)). An extended list of applications using Lua can be found here.

The Lua.NET project integrates Lua with the Common Language Infrastructure, a framework for language interoperability. This integration allows Lua to act both as a "client" language and as a "server" language, although with a limited capacity for the latter. As a client, Lua scripts can access components available through the CLI. As a server, Lua scripts can implement new components accessible by other languages integrated with the CLI.

Because Lua is an interpreted language with dynamic typing, its integration with the CLI demands a dynamic nature. Lua.NET employs two approaches for this integration. The first uses the same techniques used to implement LuaOrb, a scripting tool that canaccess and implement CORBA, COM and Java components. The approach is implemented by the LuaInterface library.

The second approach compiles Lua to the CLI's Common Intermediate Language, instead of its own bytecode representation. This approach is implemented by the Lua2IL compiler.

The authors of the Lua.NET project are Roberto Ierusalimschy, Renato Cequeira and Fabio Mascarenhas. The project is sponsored by Microsoft Research and CAPES.


Fabio Mascarenhas, Roberto Ierusalimschy. LuaInterface: Scripting the .NET CLR with Lua. Journal of Universal Computer Science, 10(7):892-908, July 2004.

Fabio Mascarenhas, Roberto Ierusalimschy. Running Lua Scripts on the CLR Through Bytecode Translation. Due for publication in a special edition of the Journal of Universal Computer Science.