News for hackers. Stuff that matters.
Re:A first look at WebAssembly performance by hajile on Thursday February 09, 2017 @10:29AM (#13607557)
> I, for one, hope that WebAssembly will enable, say, Lua as a first class citizen on the web.

I can think of several languages I'd like to use on the web, but never really considered Lua.

I'm curious. Why Lua?

Re:A first look at WebAssembly performance by rch on Thursday February 09, 2017 @11:22AM (#13608020)
Apart from general fitness for embedding and extending, I like the versatility of Lua tables:

https://www.lua.org/pil/3.6.html

In particular, to initialize a table to be used as a record:

    a = {x=0, y=0}
which is equivalent to:

    a = {}; a.x=0; a.y=0
and:

    a.x = nil -- removes field "x"
But I think Guido's right about 0-based indexing:

http://python-history.blogspot.com/2013/10/why-python-uses-0...

Re:A first look at WebAssembly performance by strainer on Thursday February 09, 2017 @06:28PM (#13612028)
local a = {x=0,y=0} --lua table definition

is very similar to

var a ={x:0,y:0} //javascript object definition

Lua is great but that 1-based indexing is very unfortunate - works fine in itself but clashes badly with the norm.

Re:A first look at WebAssembly performance by Derbasti on Friday February 10, 2017 @02:24AM (#13613804)
Most popular dynamic programming languages are well-loved because they have huge standard libraries, which can largely not be ported to a browser sandbox. This is why I don't see how, say, Python or Ruby would be good sources of WebAssembly.

Lua, on the other hand, is a tiny language. It is remarkably well-designed, with a very simple type system, a very simple syntax, but nevertheless, Lua is extremely flexible.

I have spent a few years with Lue, and I have come to admire it, for it feels as flexible as Ruby, but at the same time more consistent than Python, and faster and simpler than either of those. And, needless to say, none of the inconsistencies of JavaScript.

Lua's stated goal is embeddability. The whole language including the parser and the standard library fit in a few hundred Kb. The bytecode only has a handful of very simple instructions. The source code is exceedingly well-structured and easy to understand.

I think Lua could be a very simple drop-in replacement for JavaScript, doing exactly the same thing that JS does today, but using a much nicer programming language. And it already comes with an object system, modules, and a string manipulation library.

I like Lua.