HNHacker News
TopNewBestAskShowJobs

leafo

2,249 karma · joined August 28, 2010

check out MoonScript: http://moonscript.org
submissionscomments
leafo··on Show HN: Lapis – A web framework for MoonScript and OpenResty
Yes I'll have a better testing setup in the near future. (Right now there are individual unit tests scattered in the modules themselves)

Glad you like the documentation, I try to take pride in writing detailed documentation. :)

leafo··on Show HN: Lapis – A web framework for MoonScript and OpenResty
I'd definitely like it to be part of the benchmarks project. When I get some time I'll submit a pull request for it.

As mentioned in the other comment I use this for recording animations: https://github.com/rprichard/x11-canvas-screencast

leafo··on Show HN: I made a site for hosting/selling indie games
A directory is coming soon. I'm looking to get a collection of games before I build a showcase for them. The point of the service is to make it very simple to build a page/storefront for a game along with providing niceties like file hosting, image hosting, and analytics.
leafo··on Show HN: I made a site for hosting/selling indie games
Good to know, thanks.
leafo··on Show HN: I made a site for hosting/selling indie games
Yeah I thought about that. I figured a small percentage of people would be using linux so not that many people would get confused.
leafo··on Show HN: I made a site for hosting/selling indie games
Browser games is definitely close to the top of my to-do list
leafo··on Show HN: I made a site for hosting/selling indie games
All of those sites have a huge barrier to entry. If you were an indie game dev and you wanted to start selling your game immediately it is not possible with those sites. There is an entire market of tiny game developers who never would dream of selling their game on something like steam. This gives them the opportunity to host their game, and set a minimum price of say 0. Now they have the potential to make money off of their side projects. I'd say that's a pretty empowering.
leafo··on Show HN: I made a site for hosting/selling indie games
The technology stack of the site is pretty interesting. I wrote a little about it here:

http://leafo.net/posts/introducing_itchio.html#technology

Essentially the web app runs directly inside of nginx (but a special build of nginx from the project OpenResty[0]). The entire site is coded in MoonScript[1], which is my language that compiles to Lua.

I developed a web framework called Lapis while making this site, it doesn't have documentation yet but you can find the source here: https://github.com/leafo/lapis

I you want to see another sample Lapis webapp you can check out my MoonRocks project. The source is here: https://github.com/leafo/moonrocks-site

[0]: http://openresty.org/

[1]: http://moonscript.org

leafo··on Show HN: I made a site for hosting/selling indie games
I used this cool project: https://github.com/rprichard/x11-canvas-screencast

It definitely deserves some stars. It's based off of https://github.com/sublimehq/anim_encoder

leafo··on Luvit – Asynchronous I/O for Lua
I also agree this is a very powerful approach. If you'd like to see it in action already you should check out [OpenResty](http://openresty.org/). It's a platform for doing Lua directly on top of nginx. Each request can run Lua from within a coroutine, and and you can issue nginx subrequests which block Lua code but don't block the sever. See [ngx.location.capture](http://wiki.nginx.org/HttpLuaModule#ngx.location.capture) and [ngx.location.capture_multi](http://wiki.nginx.org/HttpLuaModule#ngx.location.capture_mul...) for issuing multiple in parallel.

nginx's subrequests can do just about anything with the right modules, from database queries to HTTP requests. Effectively turning nginx into your event loop. It's a very interesting idea.

I've just started using it, but I'm excited to make something with it.

leafo··on MoonScript v0.2.2 is released
Nope. I know nothing about emacs so I haven't even attempted it. I'm sure the CoffeeScript one could be slightly modified to fit MoonScript.
leafo··on MoonScript v0.2.2 is released
I've thought about this. It doesn't make as much sense in Lua. An iterated variable it gets it's own local assignment for each iteration. The variable isn't shared like JavaScript:

http://moonscript.org/compiler/#14

Here I create 10 functions closed on the loop value. Then I loop over them and call them all. In JavaScript this would print 10 10 times, but in Lua we get the 1 through 10.

leafo··on MoonScript v0.2.2 is released
I didn't roll my own parser generator, I used LPeg: http://www.inf.puc-rio.br/~roberto/lpeg/

It's a great library, I highly recommend it.

I've assembled a few parsers using various tools, and I must say PEGs are my favorite. They are very flexible and performance is comparable. (even CoffeeScript 2.0 is being written with a PEG.)

You can check out the guts of the parser here: https://github.com/leafo/moonscript/blob/master/moonscript/p...

leafo··on Lua to Javascript translator
This is a cool project, but sadly it's not a complete Lua. It's missing two of Lua's most powerful features:

A lot of the metatable functionality just won't work: http://www.lua.org/manual/5.1/manual.html#2.8

Second, it's missing co-routines. Which is a way to suspend the execution of a piece of code.

These features aren't possible in a compiler that simply translates from Lua to JS because JS doesn't have the ability to reproduce these concepts in its own constructs. You would have to output significantly different code to simulate these features.

Without these you're just writing JavaScript in another dialect.

leafo··on Buildpacks: Heroku for Everything
I maintain a buildpack for lua if anyone is interested: https://github.com/leafo/heroku-buildpack-lua
leafo··on LulzSec indictment published
and here's link to pdf http://www.mediafire.com/?9264mdslw3sm630
leafo··on LulzSec indictment published
no ads, change doc to fullscreen in the url: http://www.scribd.com/fullscreen/84156085/
leafo··on Why Lua?
Lua is a great platform, but I think there are a lot of areas where it can be made more programmer friendly. That's why I wrote http://moonscript.org/
leafo··on Cloud app functionality on Linux using +Dropbox
Here's my two line shell script that accomplishes the same thing (sans dropbox). Been using it for years and it's a lifesaver.

https://gist.github.com/1683661

You need scrot, xclip, and libnotify. Set up private key ssh access to your webserver and update the directories/url and you're good to go.

leafo··on The Problem with Implicit Scoping in CoffeeScript
Look at how MoonScript handles this: http://moonscript.org/reference/#the_using_clause_controllin...

I didn't want to change the default semantics, but I wanted to have a way for the programmer to be safe if they wanted to, so I created the `using` keyword for function declarations.

You explicitly declare what you intend to overwrite in the lexical scope, including overwriting nothing at all with `using nil`.

leafo··on MoonScript v0.2.0 Released
Lua is actually pretty verbose. The MoonScript codebase is about 1700 lines of MoonScript and it compiles up to 3k lines of Lua (and that's without whitespace and comments)

Things like classes, comprehensions, and other syntactic sugar really do help with writing concise and easy to read programs.

leafo··on Colony, an experimental JavaScript-to-Lua compiler
If you like CoffeeScript you should try out http://moonscript.org

CoffeeScript inspired syntax that compiles right to Lua.

leafo··on Codify: native coding environment for iPad
I've love to see http://moonscript.org support.
leafo··on MoonScript - A programmer friendly language that compiles to Lua.
I think it being difficult to read is entirely subjective. I don't know Haskell, and if I were to look at the code for a Haskell project I wouldn't understand it, but that doesn't mean that those who use it find it difficult to read.

After writing the majority of the compiler in MoonScript itself, and some other scripts, I've actually grown to like it and I find it perfectly readable. More readable than Lua in fact, because half of the text on my screen isn't the keyword `local` :). Try it out, if you code Lua then I think you might like it.

leafo··on MoonScript - A programmer friendly language that compiles to Lua.
I can understand your doubt. After writing a decent amount of Lua I really started to notice it lacking succinct ways to express things that I've become used to in other languages.

So I wrote the language for myself to use, but I've opened it up for other people because I think there is some potential for it. The use case for MoonScript is the same as the use case for Lua.

Also I have done a lot of mitigate the pains of compiling and debugging. It's actually pretty seamless, I've done stuff like automatic code compilation on require, and error line number rewriting. I urge you to check out the documentation: <http://moonscript.org/reference/#moonscript_api>;

leafo··on MoonScript - A programmer friendly language that compiles to Lua.
Hi, I'm the author. You're right about the resemblance to CoffeeScript. I added some recognition at the bottom. Thanks for pointing it out, I just got the site up within the last hour so there are still finishing touches to be made.
← PreviousPage 4 of 4