Live data from Hacker News

Learn Lua in 15 Minutes

tylerneylon.com

21–30 of 99 posts

Re: Learn Lua in 15 Minutes

#21

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…

I find the inline-commented version a bit easier to read and to reason about, personally.

Re: Learn Lua in 15 Minutes

#22
Having a font size of 25.33pt makes the website impossible to read without zooming out 3 steps. I would be happy if people stopped using tiny and huge default font sizes.

Re: Learn Lua in 15 Minutes

#23
I'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 of the function contains references to f."

[1] http://www.lua.org/manual/5.2/manual.html#3.4.10

Re: Learn Lua in 15 Minutes

#24
post #19

This 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)

I remember Pascal being fairly popular, and it does both. (Except if you count comments, but i assume that was not what you meant.)

EDIT: Also Fortran.

Re: Learn Lua in 15 Minutes

#25

This 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

#26
Nice work!

One 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

#27

I'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…

What this means in practice:

  > local g=function() print(type(g)) end g()
  nil
  > local function g() print(type(g)) end g()
  function

Re: Learn Lua in 15 Minutes

#28
post #25

This 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

What do you want to do that you cannot do because of the lack of Unicode support?

Re: Learn Lua in 15 Minutes

#29
First, that was very useful; bookmarked.

That 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

#30

I'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…

You're right; I fixed that part.
Post reply on HN