NLua - 基于Lua的C#脚本引擎

Nlua

NLua is the bind between Lua world and the .NET world.

NLua is a fork of project LuaInterface (from Fábio Mascarenhas/Craig Presti).

NLua - 基于Lua的C#脚本引擎

Example: using NLua from command line.

NLua allow use Lua from C#, using Windows, Linux, Mac, iOS , Android, Windows Phone 7 and Windows Phone 8.

Linux: NLua - 基于Lua的C#脚本引擎

OSX: NLua - 基于Lua的C#脚本引擎 Download NLua - 基于Lua的C#脚本引擎

iOS : NLua - 基于Lua的C#脚本引擎 Download NLua - 基于Lua的C#脚本引擎

Android: Download NLua - 基于Lua的C#脚本引擎

Win32: Download NLua - 基于Lua的C#脚本引擎

Win64: Download NLua - 基于Lua的C#脚本引擎

Windows Phone 7: Download NLua - 基于Lua的C#脚本引擎

Windows Phone 8: Download NLua - 基于Lua的C#脚本引擎

Windows: We don‘t have a CI Server for Windows. You can build NLua , you will need (msysgit, CMake, NUnit) http://screencast.com/t/rYuDtCdFG7

            string script = @"

            local s = Scriptable (""My String Parameter"")
            s:DoSomething ()

            print (s.Param1)

            local ret = s:SumOfLengths (""Name"", 10);

            print (tostring(ret))

            Scriptable.Print(""Hello NLua"")

            s.Param3 = 0.5;

            local p2 = tostring(s.Param3)

            print (p2)
            ";

            using (Lua lua = new Lua ()) {

                lua.LoadCLRPackage ();

                lua.DoString (@" import (‘NLuaSample‘) ");

                lua ["gValue"] = "This is a global value"; // You can set a global value.

                var returns = lua.DoString (script);

                Console.WriteLine (returns);
            }

NLua - 基于Lua的C#脚本引擎

上一篇:Spark 源码分析 -- task实际执行过程


下一篇:Azkaban的基础介绍