Is it possible to connect Lua and javascript?

橙三吉。 提交于 2020-11-28 02:09:55

问题


I'm not sure if the question is well-posed as english is not my mother tongue. Is it possible to connect lua and javascript together? I did not find anything about that yet.

Or is it possible e.g. in a html-file to script with both languages like

<html>
<head>
</head>
<body>
    <script></script>
    <?lsp 
    ?>
</body>
</html>

and maybe to share information between those languages?!

or ist it maybe possible to use lua in js or js in lua? like

<script><?lsp ?></script>
<?lsp 
<script></script>
?>

回答1:


You have a few options for Lua usage on the front-end (this is probably what you're aiming for as you'd like to connect/replace JS with Lua):

  • https://github.com/paulcuth/starlight
  • https://github.com/gamesys/moonshine
  • https://github.com/fengari-lua/fengari

There is some interesting WASM stuff in the works, like:

  • https://github.com/vvanders/wasm_lua
  • https://github.com/serprex/luwa
  • https://github.com/fperrad/lua.wasm

For back-end there are even more options. Most noticeable are probably:

  • https://github.com/leafo/lapis
  • https://github.com/daurnimator/lua-http/
  • https://github.com/sailorproject/sailor
  • https://openresty.org/en/
  • https://github.com/sumory/lor
  • https://github.com/luvit/luvit

I've listed just a few. There is a lot.



来源:https://stackoverflow.com/questions/48851011/is-it-possible-to-connect-lua-and-javascript

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!