leafo
leafo.net · Personal blog · on HN since 2011
Personal site of Leaf Corcoran, creator of itch.io, who writes on Lua, MoonScript, the Lapis framework, and parsing.
What HN saysHN commenters praise him as an inspiring programmer who ships projects, and recommend Lapis as a fast, Rails-like OpenResty web framework.
73HN people shared it
50linked it in comments
34stories submitted
1.2Kstory points
1 year agolast shared
2011people per year2026
Most-shared posts
- 1Lapis – A Lua, Moonscript Framework built on OpenResty39 people · 552 points · first shared 2013 · 46 comments on HN
- 2Itchio and coroutines (using OpenResty and Lua/Lapis) (2016)14 people · 31 points · first shared 2016 · discussion on HN
- 3Introduction to Parsing Grammar Expressions with LPeg5 people · 2 points · first shared 2016 · discussion on HN
- 4Writing a DSL in Lua (2015)4 people · 205 points · first shared 2017 · 41 comments on HN
- 5Introducing itch.io: a marketplace for hosting indie games4 people · 92 points · first shared 2013 · 35 comments on HN
- 6Homepage4 people · first shared 2015
- 7Aroma: A game creation framework for Lua2 people · 113 points · first shared 2012 · 34 comments on HN
- 8Nginx image processing server with OpenResty and Lua2 people · 106 points · first shared 2013 · 31 comments on HN
- 9Show HN: Sticky-kit, a library for making sticky elements in JavaScript2 people · 6 points · first shared 2013 · discussion on HN
- 10Show HN: I wrote a SCSS compiler in PHP2 people · 4 points · first shared 2012 · discussion on HN
- 11MoonScript v0.2.2 is released1 people · 59 points · first shared 2012 · 12 comments on HN
- 12MoonScript v0.2.0 Released1 people · 35 points · first shared 2011 · 12 comments on HN
- 13Cloning a function in Lua1 people · 14 points · first shared 2015 · discussion on HN
- 14Running Lua on Heroku1 people · 10 points · first shared 2012 · discussion on HN
- 15Introducing Streak Club1 people · 9 points · first shared 2015 · discussion on HN
What HN people wrote when they linked it
canadianfella · 2021-04-22
That’s great news.
I’ve been following moonscript and lapis for years, made by the same guy.
https://leafo.net/
blondin · 2019-10-20
i am so happy to see leaf's work here on hn. he started itch.io! check out his other amazing projects at https://leafo.net.
he is one of my favorite programmers of all time and a great inspiration. his ability to start and actually deliver projects is what amazes me much. i saw the beginnings of itch.io, this very project, that lua spin-off, that custom nginx thingy. it's so amazing when you look at what these projects now. i mean when does one have time lol
corysama · 2018-09-13
Speaking from daydreams and not experience, I’ve always thought the combination of http://leafo.net/guides/parsing-expression-grammars.html and http://terralang.org would be a great toolset on which to build a language.
etiene · 2016-01-27
I also suggest looking openresty based frameworks, it is non blocking I/O, but you can write procedural code normally and Nginx will handle events internally. That means no callback hell
There's Lapis, by leafo http://leafo.net
And I'm also improving Nginx experience on the framework I develop, Sailor, because it was originally developed for Apache http://sailorproject.org
thegeomaster · 2015-09-23
There's also Lapis, a really great and reasonably feature-full web app framework for OpenResty: http://leafo.net/lapis/. I wrote a website in it recently and was pleasantly surprised at how cool it is. It reminds me a lot of Rails, but everything works faster, especially on LuaJIT, and I actually like MoonScript (the compile-to-Lua language I'm using) for its expresiveness and aesthetics. Definitely recommend checking it out.
Cyph0n · 2015-07-10
Yep Lapis is a work of art, just like the rest of leafo's work [1].
Lapis and OpenResty (?) are actually used to power the online indie game store run and built by leafo [2].
[1]: http://leafo.net
[2]: https://itch.io
erikcw · 2015-07-10
I've had great results using OpenResty in combination with the Lapis[0] framework. Screaming fast and pretty easy to work with.
[0] http://leafo.net/lapis/
rudolf0 · 2015-04-14
Look into OpenResty (http://openresty.org). I'd also recommend Lapis (http://leafo.net/lapis/), which provides a Rails-ish MVC framework over OpenResty.
fuzzythinker · 2014-10-07
To get conversations started..
Lapis[1] on Openresty[2] is one of the most simplest, documented, and performant full web framework stack out there, yet almost no one knows it.
Hello World Open[3] - 2.5k teams, only 17 ( < 0.7% ) teams used Lua. This is an open competition, which means people can use their favorite language instead of Java, and less than 1% uses Lua.
The lua community really need to start doing something about this.
1. http://leafo.net/lapis/
2. http://openresty.org/
3. https://helloworldopen.com/teams
leafo · 2014-04-06
Kinda surprised seeing this here. I made this project 2 years ago and haven't updated it since. It was an interesting proof of concept, but I only took it far enough to run a couple of my games. The only takeaway was that I was really disappointed with the performance of native client OpenGL.
The modern version of Love supports OpenGL ES though so a rewrite like this isn't required, a better approach would just be to try to compile Love.
If you want to see more cool stuff I've done with Lua:
Moonscript: http://moonscript.org
Lapis: http://leafo.net/lapis
jhancock · 2013-07-14
I've been thinking along these lines for a while. For python-based, I think your toolkit is a good stake in the ground.
I think Lua-based is very interesting.
openresty is a great choice for replacing the simple glory of what Apache/PHP once was.
Although, Lapis (moonscript/Lua) adopts "Web-MVC", the way its coded is a toolkit of un-opinionated libs. You can skip the MVC stuff and just have a clean set of libs for throwing things in a directory and getting your bang for very few bucks.
http://leafo.net/lapis/
http://moonscript.org/
http://openresty.org/
fcambus · 2013-07-05
Lapis is also worth mentioning : http://leafo.net/lapis/
Lapis is a framework for building web applications using MoonScript (or Lua) that runs inside of a customized version of Nginx called OpenResty.
raytopia · 2024-05-25
Lapis is the framework that itch.io uses. [1] It also uses MoonScript [2] as the programming language which was also written by the creator of itch.io/Lapis.
1. https://leafo.net/posts/introducing_itchio.html
2. https://moonscript.org/
biftek · 2024-05-25
Looks like you can bypass the lapis renderer and use ngx.print() and ngx.header() to control the response yourself
Look under skip_render here: https://leafo.net/lapis/reference/actions.html#render-options
aziis98 · 2023-12-28
Hi, saw the post on Lobster [1] but didn't have an account there even if that post was more active.
I'm sure it was fun porting the Lua parser to Go and all but I wanted to let you know that Lua is very powerful on its own for making very nice DSLs, for example it can be used to make an HTML Builder DSL akin to JSX within the language itself (and by the way I think it's far more readable than JSX or XML) [2] and also some build tools use it as a base language [3]
[1]: https://lobste.rs/s/oubncm/i_made_jsx_for_lua_because_i_hate_static
[2]: https://leafo.net/guides/dsl-in-lua.html
[3]: https://xmake.io/#/getting_started
alexjplant · 2023-05-28
> webserver (nginx)
How timely! Right now I'm learning Lapis [1] by building a toy CRUD app that I plan on deploying to fly.io. Lua reminds me of Go insofar as it's a really "dumb" language. You can't get too cute and there are a few powerful abstractions that let you accomplish a lot. Coming from Python (which is an endless horizon of PEPs and build artifact standards and name mangling and kwargs and... well, you get the idea) it's kind of a breath of fresh air.
As for 1-based indexing: it makes more sense. We're all just used to 0-based because that's how C worked. If you stop and think about it early C was really just a veneer on top of assembly and since addressing an array in memory meant having a pointer to the first element that meant that it was arr[0]. We have no need for this decades later.
[1] https://leafo.net/lapis/
oliwary · 2022-06-16
Lua also powers itch.io! [0] Leafo, the creator, has also built Moonscript [1], a language that compiles to lua, and Lapis [2], a web-framework for Lua and Moonscript. I am always fascinated by his productivity.
[0] https://leafo.itch.io/
[1] https://moonscript.org/
[2] https://leafo.net/lapis/
mhd · 2020-09-15
Yeah, IIRC originally the nginx/lua integration was more about dynamically extending the core features and configuration, like virtual hosts or proxies.
But that does get you a pretty high-speed interface, if you're willing to bet your money on both nginx and lua.
There are some higher-level abstractions available, like lapis[1], which powers itch.io.
[1]: https://leafo.net/lapis/
soapdog · 2020-07-06
also, just a sidenote which you might already be aware of, a lot of itch.io used to be written in Lua. Check out Moonscript, A language that is like the coffeescript of Lua (https://moonscript.org), and Lapis which is a web framework (https://leafo.net/lapis/) that can use Lua or Moonscript. Itch.io used to be built with both, I don't know if that remains true today.
lactobacillis · 2020-06-18
The are a few lua lapis users out there: https://leafo.net/lapis/
Tombar · 2020-05-26
if you like openresty, dont miss https://leafo.net/lapis/
Lapis is a framework for building web applications using MoonScript or Lua that runs inside of a customized version of Nginx called OpenResty.
srean · 2020-02-01
Creator of Moonscript and Lapis [0] Leafo [ https://news.ycombinator.com/user?id=leafo ] hangs out here from time to time
[0] https://leafo.net/lapis/
minxomat · 2019-04-20
Yep, PEGs are seriously underutilized. Here's a nice introduction using LPeg: http://leafo.net/guides/parsing-expression-grammars.html
chc4 · 2019-01-27
Leafo wrote a blog post[1] a while back about how Lapis/OpenResty uses coroutines to implement seemless asynchronous functions that I always thought was interesting. I've been meaning to play around with Lapis to see how easy it is to work with...
[1]: http://leafo.net/posts/itchio-and-coroutines.html
anonfunction · 2018-03-30
Just FYI there is a popular Lua framework called Lapis
http://leafo.net/lapis/
Twisol · 2018-02-06
Coroutines are quite nice for managing sessions with asynchronous events, like stateful GUIs or client-server interactions. If you're familiar with the tendency of callbacks in e.g. JavaScript to nest deeply, you can think of coroutines as a way to recover a flat, procedural style.
I'm a particular fan of how coroutines work in Lua. Here's an article that helps explain them a bit in that context: http://leafo.net/posts/itchio-and-coroutines.html
marktangotango · 2017-11-05
This is really cool, I'd love to write frontends in Lua. For side project backend development, I've been using Apache and mod_lua[1] (Openresty is Lua for nginx[2]) for a couple of years now. In particular Lua with Luajit is such a kick ass platform, I've always wondered why it hasn't gotten more attention than it has. There are at least two high quality event loop http servers written with it [3][4] and some quite mature web application frameworks [5][6]. Really seems like the Lua backend story is set to explode.
[1] https://httpd.apache.org/docs/trunk/mod/mod_lua.html
[2] https://openresty.org/en/
[3] https://luvit.io/
[4] https://github.com/daurnimator/lua-http
[5] http://leafo.net/lapis/
[6] http://sailorproject.org/
lasfter · 2017-10-15
Have you considered Lua? You can develop web apps with Lapis [1] and do your data analysis with Torch [2].
The tradeoffs compared to Python: LuaJIT is much faster, which should ease your scaling worries, but the ecosystem is not as developed.
[1] http://leafo.net/lapis
[2] http://torch.ch/
fasterthanlime · 2017-05-29
moonscript powers the itch.io indie marketplace -
the original announcement has a quick write-up: http://leafo.net/posts/introducing_itchio.html
After spending years working with Ruby or Java, it was a very nice change of pace. Lapis (leaf's web framework) is crazy good as well: it's easy to write fast code, see this article on coroutines: http://leafo.net/posts/itchio-and-coroutines.html
(disclaimer: I work there with Leaf!)
kraftman · 2017-02-15
Openresty does this quite nicely with Lua: you just write your code as normal and it handles the rest in the background. http://leafo.net/posts/itchio-and-coroutines.html