在C#中使用Lua的最有效方法是什么? [英] What are the most effective ways to use Lua with C#?

查看:106
本文介绍了在C#中使用Lua的最有效方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,Lua是一种可嵌入的脚本语言,可以对对象执行方法.有哪些陷阱要避免?将Lua用作解释器并在Web环境或规则引擎中执行方法是否可行?

From my understanding, Lua is an embeddable scripting language that can execute methods on objects. What are the pitfalls to avoid? Is is it feasible to use Lua as an interpreter and execute methods in an web environment or as a rule engine?

推荐答案

Lua非常快-脚本可以预编译为字节码,并且函数可以在接近C ++虚拟方法调用的情况下执行.这就是为什么在游戏行业中将其用于脚本AI,插件和其他高级游戏脚本的原因.

Lua is very fast - scripts can be precompiled to bytecodes and functions execute close to C++ virtual method calls. That is the reason why it is used in gaming industry for scripting AI, plugins, and other hi-level stuff in games.

但是您将C#和Web服务器放在了问号中.

But you put C# and web server in your question tags.

如果您不打算使用嵌入式Web服务器,那么Lua并不是很强大. Lua是ANSI C-它可以编译为本机代码,因此,它既不欢迎您的asp.net服务器,也不欢迎您的C#代码.考虑中等信任"或绑定"或"64位".

If you are not thinking of embedded web servers - than Lua is not very strong. Lua is ANSI C - it compiles to native code, and as such it is not very welcome to your asp.net server, nor to your C# code. Think of "medium trust" or "binding" or "64bit".

足够的陷阱.如果您已经准备好使用C#,则没有理由在Web服务器上避免使用它.它被编译和缓存.它托管着像这样的大型网站.

Enough of pitfalls. If you are allready using C#, there is no reason to avoid it on web server. It gets compiled and cached. It servers huge sites like this one.

这篇关于在C#中使用Lua的最有效方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆