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

时间:2023-03-08 16:35:21

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);
}