HNHacker News
TopNewBestAskShowJobs

leafo

2,249 karma · joined August 28, 2010

check out MoonScript: http://moonscript.org
submissionscomments
leafo··on Lapis – A web framework for Lua or Moonscript
Hey, I'm Leaf and I made lapis. Thanks for sharing this

Although a new version hasn't been deployed in a while it's still heavily used (and developed, but it's been mostly stable for me). My current main thing is https://itch.io, which is powered by lapis. I have a bunch of other sites running on it too: https://streak.club https://sightreading.training and I also made https://luarocks.org

itch.io is the largest thing I've ever started, it's currently about 220k lines of MoonScript code.

Feel free to ask any questions!

leafo··on Valve creates new revenue sharing tiers to give big sellers a break
> That doesn't generalize across different titles. Maybe some title has zero visibility on Steam, but some visibility on itch.io. Then you're better off with itch.io.

as the person who runs itch.io, I can say that this is true

leafo··on Ask HN: How to learn to play piano? (kids and adults)
I built this tool that you might find useful. It uses chrome midi api to let you play piano into your browser: https://sightreading.training/

It's not going to teach you how to play piano, but it's good for drilling reading notes.

leafo··on PuzzleScript – an open-source HTML5 puzzle game engine
Hey, thanks for replying. There was a lot of interpretation of my tweet that wasn't true, I posted a follow up:

https://twitter.com/moonscript/status/1004802016252551173

We don't "intend to police," our moderation policies have never changed.There's a lot of weird stuff on itch.io that will always have a place. We don't want hate speech on the platform.

It's easy to have a gut reaction of supporting free speech without understanding the implications of what that entails. Many of the people clamoring for free speech on gaming platforms still want games to be removed ('asset flips', things they deem low quality, etc.). With my tweet, people conjured up an idea of a morality police force which is secretly making decisions about things people are allowed to say. That image is easy to attack, but it's not even close to how itch.io works, or will ever work.

The reason why I criticized Steam's stance is because they're trying to avoid responsibility. I'm sure you're familiar with how discourse goes on the internet: people with strong negative opinions are going to put in significantly more energy into spreading their message than an average person who just wants to read around. Their amplified message does not represent everyone as a whole though. Sure Steam can ban 'trolling,' but that's too vague. I have a pretty strong feeling that their 'trolling' ban is going to end up policing the morality of message as well. And, their process is probably going to be even more secretive.

leafo··on PuzzleScript – an open-source HTML5 puzzle game engine
A while back I wrote a puzzlescript detector for itch.io, all the browser based games that use it are automatically tagged. You can see them here: https://itch.io/games/made-with-puzzlescript
leafo··on Show HN: Write every day, measure your progress, achieve your writing goals
In case anyone is interested in general purpose streaking, I made a website for people to do any kind of creative streak: https://streak.club/
leafo··on How to Learn Piano with Technology
If anyone is interested, I've been building a tool to help you learn sight reading and other piano skills. It runs in your browser and connects to a keyboard with the web midi api (chrome only)

You can check it out here: https://sightreading.training/

It's opensource: https://github.com/leafo/sightreading.training

It's very WIP, but I've used it a lot and I've definitely got a lot faster at reading notes. There isn't a good way right now to read rhythm in it. I pretty much use it as an experimental area for me to test new ideas to practice stuff, so there are a lot of little tools in there

leafo··on Time for Makefiles to Make a Comeback
It's my favorite build system. A big advantage is automatic dependency tracking. It picks up unspecified inputs and automatically rebuilds anything further down the dependency tree. It also knows how to clean up files that it no longer generates since it understands you removing and adding build steps.

I can do huge refactors and it cleans up files without any additional work from me. The filesystem watch automatically builds things so I never have to run it directly. I use it on my production server when deploying since it's 100% accurate at incrementally moving between different project states.

There are definitely some disadvantages, you have to work around its syntax and limitations. For complicated build functions I've written the config in Lua and it works fine.

leafo··on Flash Bit Rot, and how WebGL can fix it
I'm the founder of itch.io which was mentioned in this article, if you want to find plugin-less web games then you can you go to the appropriate page: https://itch.io/games/html5

I realize that that link may have been a little hidden so I put that link into the homepage & sidebar of browse pages.

I think it's interesting how we've accumulated so many games that are dependent on a plugin. I'm looking forward to JavaScript implementations of these things in the future that will enable us to convert them over to HTML5. The good news is that these games are sitting in our database not going anywhere, so when the time is right we can make them easily available again. (classic Unity plugin games are the biggest offender right now, we have quite a few: https://itch.io/games/unity)

leafo··on MoonScript, a programmer friendly language that compiles to Lua
I am, and I'm pretty exited about it. I haven't had a chance to work with it yet but I might mess around with it next ludum dare.
leafo··on MoonScript, a programmer friendly language that compiles to Lua
For many libraries, it's pretty easy to write code that works across all the versions. For many differences it's not too difficult to implement code for maximum compatibility: http://leafo.net/guides/setfenv-in-lua52-and-above.html

For me personally, the advantages of luajit currently outweigh the desire to upgrade to newer versions of the language.

Regarding Lua 5.1 being old, I haven't really found it to be an issue.. Lua isn't like most scripting languages, it doesn't come with a huge standard library. It's effectively just the language and some primitives. So it ages quite well as is.

leafo··on MoonScript, a programmer friendly language that compiles to Lua
Typed Lua might be worth checking out: https://github.com/andremm/typedlua (disclaimer: I haven't used it yet)
leafo··on MoonScript, a programmer friendly language that compiles to Lua
Yup, just pre-compile the code and load it into redis as normal.
leafo··on MoonScript, a programmer friendly language that compiles to Lua
Hey all, I made MoonScript about 6 years ago.

I used it to build a ton of opensource stuff in addition to the company I founded. I use it every day and I'm very happy with how it's turned out. I regret not updating the language more frequently, but I've been busy building a bunch of stuff in it.

The biggest open source project is a web framework for Open Resty: https://github.com/leafo/lapis

It's used for the following open source websites: https://github.com/luarocks/luarocks-site https://github.com/leafo/streak.club

The company I made, https://itch.io also runs on it. There are a a ton of extra Lua modules I've made in MoonScript to facilitate it. Here's a list of my published modules: https://luarocks.org/modules/leafo

I've also completed Ludum Dare 11 times now, making a game each time in MoonScript. I've used https://love2d.org/ as the game engine. You can find the games on my GitHub: https://github.com/leafo?tab=repositories

Feel free to ask any questions

leafo··on LuaJIT 2.0.5 and 2.1.0-beta3 released
Not really, the code mapping is very straightforward and generally has no performance degradation. There are some language constructs that are implemented in a way that can create anonymous functions in order to convert statements into expressions. Future versions of MoonScript can do a better job to eliminate those. If you're aware when they're generated you can avoid them by writing as you might do in Lua. Realistically though, the performance difference is negligible in comparison to all the other things that might happen in your average web request.
leafo··on LuaJIT 2.0.5 and 2.1.0-beta3 released
Lapis is an entire web framework, OpenResty is a relatively low level interface to nginx. Lapis is an abstraction on top of OpenResty's Lua interface to make developing large web applications much more manageable.

It has nothing to do with MoonScript. MoonScript generates speedy code.

leafo··on LuaJIT 2.0.5 and 2.1.0-beta3 released
LuaJIT powers OpenResty[1] which powers my web framework Lapis[2] which powers my company itch.io[3]! (wow that's a mouthful)

Anyway, it's a stack I'm really happy to be using. Asynchronous IO without any code nesting. I wrote more about the benefits here: http://leafo.net/posts/itchio-and-coroutines.html

[1] https://openresty.org/en/

[2] http://leafo.net/lapis/

[3] https://itch.io/

I also made web server infrastructure for the Lua package manager LuaRocks in the same stack: https://luarocks.org Source is on github: https://github.com/luarocks/luarocks-site

Lua (especially with LuaJIT) is a great choice for web development.

leafo··on Zepton – a Pico-8 voxel shoot'em up [game]
Available on itch.io as well! https://chiptune.itch.io/zepton
leafo··on Ask HN: Have you created a programming language and why?
MoonScript is designed to compile to Lua, and there are no good ways to run Lua in the browser right now. It's impossible to write a Lua -> JS transpiler while matching all the same functionality (coroutines), so the only option is to run the entire Lua vm in the browser (The MoonScript online version uses this approach with emscripten).

In the future I'd like to be able to run MoonScript in the browser, maybe web assembly is the answer.

Another option would be to have a JS target for the MoonScript compiler, but there are some issues with different language features that would make code sharing difficult (1 indexed arrays, metatables, etc.)

I have no plans to give up moonscript. I haven't been actively developing it recently though, which I feel guilty about.

leafo··on Ask HN: Have you created a programming language and why?
I created a language called MoonScript in 2011

It is heavily inspired by CoffeeScript (and Python), it works as a transpiler for Lua. I've since used it regularly to code dozens of projects.

It's now powering my company along with a handful of websites and supporting libraries. I've also made games and GUI apps with it. The adoption has been pretty minimal, but I'm satisfied regardless. It has definitely improved my productivity.

http://moonscript.org https://github.com/leafo/moonscript

leafo··on Daily Sketches in 2016
If anyone is interested, I made as site for doing daily creative work, it's called https://streak.club

There's a daily art one that's been going on for a few years now that you might be interested in joining: https://streak.club/s/8/daily-art

leafo··on Ask HN: Have any side projects from Show HN gone big?
itch.io: https://news.ycombinator.com/item?id=5445029

I don't know where the big cutoff is, but it's been going strong for the past 3.5 years. There are just under 50k games on it now https://itch.io

leafo··on AngelList acquires Product Hunt
Here's a similar case that I was disappointed to see: http://leafo.net/shotslp/2016-12-01_20-43-41.png

They apparently emailed all their paying customers. What a "big surprise."

leafo··on Music theory for nerds
If anyone is interested in learning to read music, I've been slowly building a tool to practice: http://sightreading.training/

source is here (built in react, es6): https://github.com/leafo/mursicjs

It's still lacking a lot (like rhythm), but the different generators definitely give my brain a workout. It works best if you hook up a midi keyboard.

leafo··on Show HN: Using Parsing Expression Grammars to rewrite source code
Parsing expression grammars are my favorite way to parse text.

I also use Lua and LPeg. Here's a tutorial I wrote on them: http://leafo.net/guides/parsing-expression-grammars.html

Additionally, I've written an entire programming language with them: http://moonscript.org/

Here's the grammar:

https://github.com/leafo/moonscript/blob/master/moonscript/p...

My favorite part is that you express the grammar in code, not some simplified language designed to write parsers. So you get all the nice things a programming language normally gives you. (eg. you can use functions instead of having support for macros)

I've also started experimenting with compiling LPeg style grammars to C, for even more speed. This uses the peg library: https://github.com/leafo/moonparse

You can see how the grammar looks here: https://github.com/leafo/moonparse/blob/master/parse.peg.moo...

leafo··on Grokking Algorithms Is Out
if you want to get a feel for how the book will read, the author has written a handful of illustrated blog posts in a similar style:

http://adit.io/posts/2016-03-13-Logistic-Regression.html

http://adit.io/posts/2016-02-20-Linear-Regression-in-Picture...

http://adit.io/posts/2013-07-22-lenses-in-pictures.html

http://adit.io/posts/2013-05-15-Locks,-Actors,-And-STM-In-Pi...

leafo··on Itch.io refinery: A customizable toolset for first game releases and playtests
Hello,

I'm leaf, I founded itch.io 3+ years ago. I launched it on hacker news even! https://news.ycombinator.com/item?id=5445029 (it's funny reading that thread now, so many haters)

Anyway, this thing is a huge accomplishment for us. The post linked doesn't go into the technical details, but they're the reason why I think this launch is awesome.

We've built a generic binary patching system for game developers. We're providing it as a service for people who use our marketplace. We've integrated it into our desktop app, but the tools can run anywhere.

Everything is written in go right now, it's divided into our command line tool, butler, and our server architecture, wharf. (we've got some cool tools up our sleeves, like doing patch generation and uploading directly in the browser via a js implementation)

Most of it is opensource: https://github.com/itchio

The wharf documentation is excellent if you want to learn about the algorithm: https://itch.io/docs/wharf/

And we have more info about the command line tool: https://itch.io/docs/butler/

Steam provides similar technology, completely closed obv., and we were able to get on par with them, or beat them in terms of patch generation size and speed in many scenarios. And it completely destroys them in terms of simplicity. I'm really happy about how it turned out.

I'll be checking here to answer questions,

Thanks

leafo··on Nginx: a caching, thumbnailing, reverse proxying image server
I wrote a similar article a few years back that employs Lua and imagemagick bindings: http://leafo.net/posts/creating_an_image_server.html
leafo··on Ragel State Machine Compiler
Ragel doesn't support recursion (last I checked), so it's not suitable for many parsing jobs. I considered it for MoonScript's parser at one point but it didn't seem like it could do it. I've been experimenting with this project as a replacement for LPEG for the MoonScript parser: http://piumarta.com/software/peg/

I've made an LPEG style syntax that compiles to the peg syntax for that tool, which is then compiled to c and linked into a Lua module, you can see how the parser is written here: https://github.com/leafo/moonparse/blob/master/parse.peg.moo...

leafo··on How much do indie PC devs make, anyways? (Part 7)
Any other indie game marketplaces? Yeah there are a few: GOG, Indie Game Stand, Humble Bundle.

Other sites that release data like that, not sure.

← PreviousPage 2 of 4Next →