by adamansky on 3/9/13, 2:51 PM with 110 comments
by graue on 3/9/13, 5:05 PM
One of the goals of this project was to compile effects code to JavaScript with Lua.js[3] and produce a demo that ran in the browser. There, unfortunately, I ran into a showstopper with a Lua.js bug[4] that breaks my approach to creating modules. Unlike LuaJIT and regular Lua, Lua.js is an experimental project and far less mature - though totally awesome. I might make another attempt to fix the problem myself at some point. With a more mature Lua.js, you could write fast Lua code and port it to nearly every environment.
[1] https://github.com/graue/luasynth
[2] https://github.com/graue/synth
[3] https://github.com/mherkender/lua.js
[4] https://github.com/mherkender/lua.js/issues/13#issuecomment-...
by ethereal on 3/9/13, 5:18 PM
It never ceases to amaze me, as a language and as an interpreter. Sure, the syntax bites you occasionally, and sure, the lack of built-in functionality is occasionally annoying. But hey, I can add callbacks into a simulation engine that execute 10 million times per second with almost no slowdown in the result. Like the article mentions, the string matching library isn't as powerful as Perl's, but it's more than adequate for all of my uses.
My only wish is for an updated LNUM patch that works with Lua 5.2. I deal with integers too much in my projects for its absence to not be annoying.
by andrew-d on 3/9/13, 4:46 PM
[0]: http://luajit.org/ext_ffi.html [1]: http://andrew-d.github.com/lua-ext/
by peterfschaadt on 3/9/13, 9:53 PM
by shaneeb on 3/9/13, 4:21 PM
by saosebastiao on 3/9/13, 4:46 PM
by phaedryx on 3/9/13, 5:03 PM
I've been considering several different languages to start them on and Lua has turned out to be a great choice. My children both love minecraft and we've been writing programs in Lua for the computercraft mod: http://www.computercraft.info/
by greggman on 3/9/13, 5:48 PM
How is it in practice?
by vor_ on 3/9/13, 7:39 PM
http://computerscomputing.wordpress.com/2013/02/18/lua-and-s...
The best reason against using Lua in my mind is that undefined variables in Lua return nil, which can lead to typo bugs and therefore unintentional sparse arrays, which screws up the result returned by the length operator. It also has inconsistent boolean expression evaluation:
while 0 do print("Loops forever") end
while not 1 do print("Does nothing") end
while 1 do print("Loops forever") end
while not 0 do print("Does nothing") end
It's nice having real classes in Squirrel with type introspection and corresponding C APIs. In Lua, I have to juggle metatables in the registry to construct a class system, and my system will differ slightly from someone else's. Squirrel's other niceties like compile-time constants, 0-based arrays, and automatic reference counting for predictable memory management overhead make it a quite nice alternative to Lua.It sounds like I'm bashing Lua here, though I still find it fun to program occasionally. But I do wonder how long Lua can remain as popular as it is with an unconventional syntax, inconsistent behavior, and a minimal built-in library in the face of richer alternatives like Squirrel, mruby, and even Tcl, which has improved much in recent years. There must have been a reason Valve Software chose to use Squirrel in L4D2 and Portal 2 instead of using Lua as most apparently do.
by johnmo on 3/9/13, 5:31 PM
While true, you should iterate integer-key tables using ipairs and hash tables using pairs.
> No continue statement
Continue doesn't exist? I swear I've used it in Lua 5.1.
by yeureka on 3/9/13, 5:44 PM
by gruseom on 3/9/13, 5:11 PM
by xtremejames183 on 3/9/13, 10:30 PM