TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Lua for Elixir

188 点作者 davydog1873 天前

17 条评论

rickcarlino大约 11 小时前
We used Luerl, the underlying Lua engine, in production for years as a sandboxed scripting environment for FarmBot devices back in the day. Users could execute scripts directly on the device to control peripherals. It was a solid library and the community support was great. From an ergonomics perspective, developers preferred this approach over API calls. I am surprised more projects don’t provide a Lua scripting layer.
评论 #43996949 未加载
interroboink大约 7 小时前
<p><pre><code> This is not embedding the C Lua runtime and compiler, but rather a complete implementation of Lua 5.3. This feat is made possible by the underlying Luerl library, which implements a Lua parser, compiler, and runtime, all in Erlang. </code></pre> Okay, that&#x27;s actually pretty cool (:<p>Also a sign of Lua&#x27;s maturity and popularity, that it&#x27;s got various independent implementations (LuaJIT, this one, perhaps others I don&#x27;t know about).
评论 #43998879 未加载
Philpax大约 11 小时前
Very nice, but it is confusing to name a library for using a language the same thing as that language. I suppose this is meant to be a temporary state of affairs while Lua (the library) gets merged into Luerl, but I would have personally called it Luerl++ or such.
评论 #43996762 未加载
评论 #43996142 未加载
davydog187大约 9 小时前
If you&#x27;re looking for a cool example of Lua running on the BEAM, check out the creator of Luerl (Robert Virding) space ship demo<p><a href="https:&#x2F;&#x2F;github.com&#x2F;rvirding&#x2F;ship-demo">https:&#x2F;&#x2F;github.com&#x2F;rvirding&#x2F;ship-demo</a>
_acco大约 6 小时前
This is so cool. A key benefit is that it&#x27;s not embedding the C Lua runtime and compiler, but rather implements Lua in the host language (Elixir&#x2F;Erlang).<p>When sandboxing user code in another runtime, you need to serialize the data to and from that runtime. That comes with a performance penalty.<p>So, for example, if you sandbox code in WASM, you need to pick a transport data format, like JSON. You need to serialize Elixir data structures into JSON, send it to WASM, and then deserialize the result. For a high-performance data pipeline, this adds up!<p>But if your sandbox is in the host language, no serialization&#x2F;de-serialization is required. You can execute the sandboxed language in microseconds.<p>I wrote more about this here: <a href="https:&#x2F;&#x2F;blog.sequinstream.com&#x2F;why-we-built-mini-elixir&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.sequinstream.com&#x2F;why-we-built-mini-elixir&#x2F;</a><p>Wish this library existed just a couple months ago!
gilgamesh3大约 9 小时前
Cool project, congrats.<p>I am trying to understand why would anyone prefer to use Lua to create script instead of Elixir, which supports running scripts. While Lua has lots of users the language just have too many wrong design choices. If I had the choice between Elixir and Lua for scripts I would use Elixir every time.
评论 #43998119 未加载
评论 #43996894 未加载
评论 #43997432 未加载
评论 #43997370 未加载
评论 #43996493 未加载
pentacent_hq大约 6 小时前
I&#x27;ve been considering adding Lua support to Keila for a while already. It seems like a perfect fit for when I&#x27;m going to implement email automation and want to allow custom business logic. This would certainly make that plan easier. Thanks OP for sharing the library with the community!
评论 #43998020 未加载
joshprice大约 11 小时前
This is awesome! Can&#x27;t wait to find some use cases to embed a sandboxed and safe mini Lua language in our apps.<p><a href="https:&#x2F;&#x2F;hexdocs.pm&#x2F;lua&#x2F;Lua.html" rel="nofollow">https:&#x2F;&#x2F;hexdocs.pm&#x2F;lua&#x2F;Lua.html</a>
评论 #43996193 未加载
rdtsc大约 7 小时前
davydog187, I just wanted to thank you for stepping up and lending Robert a hand. It&#x27;s nice to see new releases and lots of cleanups happening in Luerl. The project is a real gem and it&#x27;s nice to see new activity in it!
评论 #43998033 未加载
jkaufmann_大约 7 小时前
I have been waiting for this my whole life
dlojudice大约 4 小时前
Fun fact (probably well-known fact for HN audience): Both Lua and Elixir were created by Brazilians. Lua by Roberto Ierusalimschy and team at PUC-Rio in 1993, and Elixir by José Valim in 2011
dpflan大约 9 小时前
Is this influenced by &quot;Embedding Python in Elixir&quot;?<p><a href="https:&#x2F;&#x2F;dashbit.co&#x2F;blog&#x2F;running-python-in-elixir-its-fine" rel="nofollow">https:&#x2F;&#x2F;dashbit.co&#x2F;blog&#x2F;running-python-in-elixir-its-fine</a><p>It certainly is more attractive in implementation. Well done!
评论 #43998062 未加载
iLemming大约 8 小时前
Does that mean I can now write Fennel to target BEAM?
评论 #43998074 未加载
binary132大约 7 小时前
How sandboxed is BEAM really?
评论 #43997623 未加载
codingbear大约 8 小时前
what is the Lua equivalent for JVM ecosystem? An embeddable language which you allows for running user scripts in a sandbox?
评论 #43998000 未加载
xvilka大约 11 小时前
There is also Lua implementation in safe Rust - Piccolo[1]<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;kyren&#x2F;piccolo">https:&#x2F;&#x2F;github.com&#x2F;kyren&#x2F;piccolo</a>
behnamoh大约 11 小时前
Recently, I had a simple Flask project, just a single Python file, and wanted to convert it to Elixir using AI. But what I got was a sprawling directory of modules and files in Elixir. Apparently, that’s just how things are done in the Elixir world. That moment made me realize why some languages catch on while others struggle. If spinning up a basic web server already feels like jumping through hoops, I can’t imagine the overhead for more complex projects.<p>I&#x27;m sure there are people who think Elixir&#x2F;Phoenix &gt;&gt; &lt;other-solutions&gt;, but for me it was a nightmare.<p>OTOH, the language is beautiful as it&#x27;s macros all the way down.
评论 #43995480 未加载
评论 #43995602 未加载
评论 #43995409 未加载
评论 #43996423 未加载
评论 #43997969 未加载
评论 #43995610 未加载
评论 #43995574 未加载