您的位置:首页 > 编程语言 > Lua

Lua 的 .NET 实现:NeoLua

2016-07-19 19:02 585 查看
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://baike.baidu.com/link?url=0Q6ZRtLqD7-sGqxoAnfEDx2EYJCluU54T1lgSswesXI2pSLBSVuaAe22p5VL61R_pzsCBDdieED-t4HJD6p0kK

http://www.open-open.com/lib/view/open1408005253192.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: