chwabyss

导航

 

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

Cmd

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: Build Status

OSX: Build Status Download dwn_osx

iOS : Build Status Download dwn_ios

Android: Download dwn_android

Win32: Download dwn_w32

Win64: Download dwn_w64

Windows Phone 7: Download dwn_wp7

Windows Phone 8: Download dwn_wp8

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);
            }
posted on 2014-01-21 16:36  chwabyss  阅读(3514)  评论(0)    收藏  举报