Lua 的 .NET 实现:NeoLua

jopen 7年前

NeoLua是Lua 语言的一个.Net实现。可以在 .NET 的应用中调用 Lua 语言或者反过来(当前支持的 Lua 版本是 5.2),其目的是遵循 C-Lua 实现并且合并完整的 .NET 框架支持。你可以很方便在 Lua 程序中调用 .NET 的 functions/classes/interfaces/events ,同时也可以轻松在 .NET 应用中调用 Lua 的变量和函数。

NeoLua 使用 C# 开发并使用 Dynamic Language Runtime. 目前 NeoLua 依赖于 .NET Framework 4,同时也支持当前版本的 Mono 框架。

What NeoLua is useful for

  • Outsource the logic of your application into scripts
  • Structuring of logic
  • Build a dynamic configuration system, with functions and variables
  • As a formula parser
  • ...

Advantages of NeoLua

  • Dynamic access between Lua script and and the host application/.NET framework and vice-versa.
  • NeoLua is based on the DLR. So you get compiled code that is collectable and well-optimized.
  • It is compatible with the .NET world (e.g. C#, VB.NET, IronPython, ...).
  • Full and easy access to the .NET framework or your own libraries (with no stub code).
  • A .NET Framework Garbage Collector that is well-tested and very fast.
  • Pure IL (x86,x64 support)

示例代码:

using Neo.IronLua;    namespace Test  {    public static class Program    {      public static void Main(string[] args)      {        // Create the Lua script engine        using (Lua l = new Lua())        {          // create a Lua script environment (global)          var g = l.CreateEnvironment();          // run a chunk, first the code, than the name of the code          g.DoChunk("print('Hello World!');", "test.lua");        }      }    }  }

Lua 的 .NET 实现:NeoLua

项目主页:http://www.open-open.com/lib/view/home/1408005253192