Along the same lines is http://hyperpolyglot.org/ (which has been posted here a few times). This is useful both for learning a new language and for a quick reference for languages you're not so hot on. It's also very interesting to compare similarities and how languages have influenced each other. It seems (from the comments here and my own experience) that many people really like this style of learning. It would be…
Learn Lua in 15 Minutes
21–30 of 99 posts
Re: Learn Lua in 15 Minutes
#22Re: Learn Lua in 15 Minutes
#23 -- These are the same:
-- ...snip...
local function g(x) return math.sin(x) end
local g = function (x) return math.sin(x) end
According to the Lua Reference Manual [1], this example isn't correct. Rather, this is the correct translation: local function g(x) return math.sin(x) end
local g; g = function (x) return math.sin(x) end
From the manual: "This only makes a difference when the body of the function contains references to f."Re: Learn Lua in 15 Minutes
#24This is awesome. On that note, I don't understand all the javascript craze. Lua has been around for quite some time, and it's small, with well-defined semantics, a nice set of features, the interpreter is small and very fast, you can get even faster with LuaJIT, etc. Browsers should have adopted that ages ago.
Because it indexes from 1 and doesn't use braces? (semi-sarcastic)
EDIT: Also Fortran.
Re: Learn Lua in 15 Minutes
#25This is awesome. On that note, I don't understand all the javascript craze. Lua has been around for quite some time, and it's small, with well-defined semantics, a nice set of features, the interpreter is small and very fast, you can get even faster with LuaJIT, etc. Browsers should have adopted that ages ago.
Re: Learn Lua in 15 Minutes
#26One nitpick: local function declarations, like
local function g(x) return g(x) end
are actually the same as writing local g;
g = function (x) return g(x) end
. Without that first local g; statement, local functions wouldn't be able to call themselves recursively.Re: Learn Lua in 15 Minutes
#27I'm going to be "that guy": -- These are the same: -- ...snip... local function g(x) return math.sin(x) end local g = function (x) return math.sin(x) end According to the Lua Reference Manual [1], this example isn't correct. Rather, this is the correct translation: local function g(x) return math.sin(x) end local g; g = function (x) return math.sin(x) end From the manual: "This only makes a difference when the body o…
> local g=function() print(type(g)) end g()
nil
> local function g() print(type(g)) end g()
functionRe: Learn Lua in 15 Minutes
#28This is awesome. On that note, I don't understand all the javascript craze. Lua has been around for quite some time, and it's small, with well-defined semantics, a nice set of features, the interpreter is small and very fast, you can get even faster with LuaJIT, etc. Browsers should have adopted that ages ago.
Maybe when it supports unicode
Re: Learn Lua in 15 Minutes
#29That took me 30 minutes to read. I think I might feel like I've learned the language after spending 8 hours working the examples a la "Learn Python the Hard Way". Luckily, I'm not competing with the folks here that learned it within 15 minutes ;-).
Re: Learn Lua in 15 Minutes
#30I'm going to be "that guy": -- These are the same: -- ...snip... local function g(x) return math.sin(x) end local g = function (x) return math.sin(x) end According to the Lua Reference Manual [1], this example isn't correct. Rather, this is the correct translation: local function g(x) return math.sin(x) end local g; g = function (x) return math.sin(x) end From the manual: "This only makes a difference when the body o…