首页 > 其他 > 详细

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

时间:2014-01-21 21:20:28      阅读:755      评论:0      收藏:0      [点我收藏+]

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).

bubuko.com,布布扣

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: bubuko.com,布布扣

OSX: bubuko.com,布布扣 Download bubuko.com,布布扣

iOS : bubuko.com,布布扣 Download bubuko.com,布布扣

Android: Download bubuko.com,布布扣

Win32: Download bubuko.com,布布扣

Win64: Download bubuko.com,布布扣

Windows Phone 7: Download bubuko.com,布布扣

Windows Phone 8: Download bubuko.com,布布扣

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#脚本引擎

原文:http://www.cnblogs.com/chwabyss/p/3528583.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!