search

Home  >  Q&A  >  body text

node.js - nodejs如何调用lua脚本?

我想在nodejs中能够调用lua脚本来执行一段逻辑,主要是客户端和服务端有一段同步逻辑,需要逻辑执行相同,客户端这边是用lua写的逻辑,不能进行修改了,服务端这边如果用js重写一样的逻辑,维护两份逻辑是很累的,所以想请教一下如何在nodejs中调用lua执行,谢谢,如果有现成的不错的npm库当然是最好的了,如果没有想请教一下如何简单的执行lua。

大家讲道理大家讲道理2784 days ago602

reply all(4)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 11:48:19

    Well, I implemented a simple synchronous lua binding for nodejs myself.

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:48:19

    If you can continue to maintain the logic of Lua, then Lua can directly serve as the backend, such as Luvit. . I haven't used it, so I don't know if it's good or bad. Of course, since lz is based on nodejs, most of the time it can’t be put down to support lua, which is a bit painful. I really don’t know if there is such thing as nodejs lua binding. Otherwise, it is not very troublesome to write one by yourself. Nodejs is extended and then called lua. It is not difficult to implement this layer of wrapper in native. It is just a workload and the efficiency should be better than js implementation. The lua interpreter is better.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 11:48:19

    Make good use of search: https://www.google.com/?gws_rd=ssl#newwindow=1&safe=off&q=js+l...

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 11:48:19

    nodejs calls the command line and executes lua

    reply
    0
  • Cancelreply