在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例一般编程问题 → 从C#中调用Lua

从C#中调用Lua

一般编程问题

下载此实例
  • 开发语言:Others
  • 实例大小:0.36M
  • 下载次数:0
  • 浏览次数:7
  • 发布时间:2024-05-23
  • 实例类别:一般编程问题
  • 发 布 人:chenxiaolan
  • 文件格式:.zip
  • 所需积分:2
 相关标签: .NET LUA NET ET UA

实例介绍

【实例简介】

NLua是一个桥梁,连接了Lua世界和.NET(兼容.NET/UWP/Mac/Linux/Android/iOS/tvOS)。您可以使用NLua从C#中调用Lua,在UWP、Windows、Linux、Mac、iOS和Android平台上运行。

public class SomeClass
{
    public string MyProperty {get; private set;}
    
    public SomeClass (string param1 = "defaulValue")
    {
        MyProperty = param1;
    }
    
    public int Func1 ()
    {
        return 32;
    }
    
    public string AnotherFunc (int val1, string val2)
    {
        return "Some String";
    }
    
    public static string StaticMethod (int param)
    {
        return "Return of Static Method";
    }
}

使用UTF-8编码:

NLua在UTF-8编码上运行。


【实例截图】
【核心代码】
文件清单
└── NLua-4c5705b826652789db096e983d86ee514fe5c8ff
    ├── build
    │   ├── Android
    │   │   ├── NLua.Android.csproj
    │   │   └── NLua.net8.0-android.csproj
    │   ├── iOS
    │   │   ├── Info.plist
    │   │   ├── NLua.net8.0-ios.csproj
    │   │   ├── NLua.net8.0-maccatalyst.csproj
    │   │   └── NLua.XamariniOS.csproj
    │   ├── macOS
    │   │   ├── NLua.net8.0-macos.csproj
    │   │   └── NLua.XamarinMac.csproj
    │   ├── net46
    │   │   └── NLua.csproj
    │   ├── net8.0
    │   │   └── NLua.net8.0.csproj
    │   ├── netstandard2.0
    │   │   └── NLua.netstandard2.0.csproj
    │   ├── targets
    │   │   └── NLua.Sign.targets
    │   ├── TVOS
    │   │   ├── Info.plist
    │   │   ├── NLua.net8.0-tvos.csproj
    │   │   └── NLua.TVOS.csproj
    │   └── uap10.0
    │       └── NLua.UWP.csproj
    ├── devops
    │   ├── azure-devops.yml
    │   ├── BuildFunctions.ps1
    │   ├── Package.ps1
    │   ├── PreBuild.ps1
    │   └── Publish.ps1
    ├── extras
    │   ├── examples
    │   │   ├── CLRPackage.lua
    │   │   ├── com.lua
    │   │   ├── ctype.lua
    │   │   ├── error.lua
    │   │   ├── form_alt.lua
    │   │   ├── form.lua
    │   │   ├── gtk-list.lua
    │   │   ├── gui.glade
    │   │   ├── hello1.lua
    │   │   ├── hello2.lua
    │   │   ├── hello3.lua
    │   │   ├── hello4.lua
    │   │   ├── hello-glade.lua
    │   │   ├── hello-gtk.lua
    │   │   ├── ilua.lua
    │   │   ├── lconsole.lua
    │   │   ├── lua-gtk.lua
    │   │   ├── lua.lua
    │   │   ├── README.md
    │   │   ├── socket_alt.lua
    │   │   ├── socket.lua
    │   │   ├── test-com.lua
    │   │   ├── testluaform_alt.lua
    │   │   └── testluaform.lua
    │   └── screenshot
    │       └── NLuaCommand.gif
    ├── LICENSE
    ├── NLua.Android.sln
    ├── NLua.Mac.sln
    ├── NLua.net8.0.sln
    ├── NLua.netstandard2.0.sln
    ├── NLua.nuspec
    ├── NLua.png
    ├── NLua.sln
    ├── NLua.snk
    ├── NLua.Symbol.nuspec
    ├── NLua.UWP.sln
    ├── README.md
    ├── src
    │   ├── CheckType.cs
    │   ├── Event
    │   │   ├── DebugHookEventArgs.cs
    │   │   └── HookExceptionEventArgs.cs
    │   ├── Exceptions
    │   │   ├── LuaException.cs
    │   │   └── LuaScriptException.cs
    │   ├── Extensions
    │   │   ├── LuaExtensions.cs
    │   │   ├── StringExtensions.cs
    │   │   └── TypeExtensions.cs
    │   ├── GenerateEventAssembly
    │   │   ├── ClassGenerator.cs
    │   │   ├── CodeGeneration.cs
    │   │   ├── DelegateGenerator.cs
    │   │   ├── ILuaGeneratedType.cs
    │   │   └── LuaClassType.cs
    │   ├── LuaBase.cs
    │   ├── Lua.cs
    │   ├── LuaFunction.cs
    │   ├── LuaGlobals.cs
    │   ├── LuaHideAttribute.cs
    │   ├── LuaMemberAttribute.cs
    │   ├── LuaRegistrationHelper.cs
    │   ├── LuaTable.cs
    │   ├── LuaThread.cs
    │   ├── LuaUserData.cs
    │   ├── Metatables.cs
    │   ├── Method
    │   │   ├── EventHandlerContainer.cs
    │   │   ├── LuaClassHelper.cs
    │   │   ├── LuaDelegate.cs
    │   │   ├── LuaEventHandler.cs
    │   │   ├── LuaMethodWrapper.cs
    │   │   ├── MethodArgs.cs
    │   │   ├── MethodCache.cs
    │   │   └── RegisterEventHandler.cs
    │   ├── NLua.Shared.projitems
    │   ├── NLua.Shared.shproj
    │   ├── NLua.Shared.shproj.user
    │   ├── ObjectTranslator.cs
    │   ├── ObjectTranslatorPool.cs
    │   ├── Properties
    │   │   └── AssemblyInfo.cs
    │   └── ProxyType.cs
    └── tests
        ├── build
        │   ├── net46
        │   │   └── NLuaTest.csproj
        │   ├── net8.0
        │   │   └── NLuaTest.net8.0.csproj
        │   ├── xamarinios
        │   │   ├── Entitlements.plist
        │   │   ├── Info.plist
        │   │   ├── LaunchScreen.storyboard
        │   │   ├── Main.cs
        │   │   ├── NLuaTest.XamariniOS.csproj
        │   │   ├── tools
        │   │   │   └── Touch.Server.exe
        │   │   └── UnitTestAppDelegate.cs
        │   └── xamarintvos
        │       ├── Assets.xcassets
        │       │   ├── App Icon & Top Shelf Image.brandassets
        │       │   │   ├── App Icon - Large.imagestack
        │       │   │   │   ├── Back.imagestacklayer
        │       │   │   │   │   ├── Content.imageset
        │       │   │   │   │   │   └── Contents.json
        │       │   │   │   │   └── Contents.json
        │       │   │   │   ├── Contents.json
        │       │   │   │   ├── Front.imagestacklayer
        │       │   │   │   │   ├── Content.imageset
        │       │   │   │   │   │   └── Contents.json
        │       │   │   │   │   └── Contents.json
        │       │   │   │   └── Middle.imagestacklayer
        │       │   │   │       ├── Content.imageset
        │       │   │   │       │   └── Contents.json
        │       │   │   │       └── Contents.json
        │       │   │   ├── App Icon - Small.imagestack
        │       │   │   │   ├── Back.imagestacklayer
        │       │   │   │   │   ├── Content.imageset
        │       │   │   │   │   │   └── Contents.json
        │       │   │   │   │   └── Contents.json
        │       │   │   │   ├── Contents.json
        │       │   │   │   ├── Front.imagestacklayer
        │       │   │   │   │   ├── Content.imageset
        │       │   │   │   │   │   └── Contents.json
        │       │   │   │   │   └── Contents.json
        │       │   │   │   └── Middle.imagestacklayer
        │       │   │   │       ├── Content.imageset
        │       │   │   │       │   └── Contents.json
        │       │   │   │       └── Contents.json
        │       │   │   ├── Contents.json
        │       │   │   ├── Top Shelf Image.imageset
        │       │   │   │   └── Contents.json
        │       │   │   └── Top Shelf Image Wide.imageset
        │       │   │       └── Contents.json
        │       │   ├── Contents.json
        │       │   └── LaunchImages.launchimage
        │       │       └── Contents.json
        │       ├── Entitlements.plist
        │       ├── Info.plist
        │       ├── NLuaTest.XamarinTVOS.csproj
        │       └── tools
        │           └── Touch.Server.exe
        ├── scripts
        │   ├── core
        │   │   ├── bisect.lua
        │   │   ├── cf.lua
        │   │   ├── factorial.lua
        │   │   ├── fibfor.lua
        │   │   ├── fib.lua
        │   │   ├── life.lua
        │   │   ├── printf.lua
        │   │   ├── sieve.lua
        │   │   └── sort.lua
        │   ├── test_32.luac
        │   ├── test_64.luac
        │   └── test.lua
        └── src
            ├── BinderClass
            │   ├── LuaITestClassHandler.cs
            │   └── LuaTestClassHandler.cs
            ├── CodeGenTests.cs
            ├── Core.cs
            ├── LoadFileTests.cs
            ├── LuaTests.cs
            ├── NLuaTest.Shared.projitems
            ├── NLuaTest.Shared.Scripts.projitems
            ├── NLuaTest.Shared.Scripts.shproj
            ├── NLuaTest.Shared.shproj
            ├── Properties
            │   └── AssemblyInfo.cs
            └── TestTypes
                ├── DefaultElementModel.cs
                ├── Delegates.cs
                ├── DoWorkClass.cs
                ├── Employee.cs
                ├── Entity.cs
                ├── GlobalsTestClass.cs
                ├── IFoo1.cs
                ├── IFoo2.cs
                ├── ITest.cs
                ├── LuaEventArgsHandler.cs
                ├── LuaTestDelegate1Handler.cs
                ├── LuaTestDelegate2Handler.cs
                ├── LuaTestDelegate3Handler.cs
                ├── LuaTestDelegate4Handler.cs
                ├── LuaTestDelegate5Handler.cs
                ├── LuaTestDelegate6Handler.cs
                ├── LuaTestDelegate7Handler.cs
                ├── Master.cs
                ├── MyClass.cs
                ├── Parameter.cs
                ├── Person.cs
                ├── PersonExtensions.cs
                ├── PrintOverrides.cs
                ├── TestCaseName.cs
                ├── TestClass3.cs
                ├── TestClass.cs
                ├── TestClassGeneric.cs
                ├── TestClassWithGenericMethod.cs
                ├── TestClassWithMethodDefaultParameter.cs
                ├── TestClassWithNLuaAttributes.cs
                ├── TestClassWithOverloadedMethod.cs
                ├── TestClassX.cs
                ├── TestEnum.cs
                ├── TestStruct.cs
                ├── Vector.cs
                └── VectorExtension.cs

55 directories, 188 files

标签: .NET LUA NET ET UA

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警