问题
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