PLDI

Lua Thoughts

6 thoughts
last posted Feb. 18, 2013, 6:21 p.m.
0
get stream as: markdown or atom
0

I definitely feel the lack of a ternary conditional expression in lua.

0

Why doesn't lua let my index strings using s[n]? I have to use s:sub(n,n). Perhaps to avoid confusion over whether the result would be a character codepoint or a string?

0

Why doesn't lua standard library have a math.round(n) or math.toInt(n) that does math.floor(n+0.5) ?

0

Lua's do/then/function ... end syntax isn't friendly to bracket matching in the editor

0

Lua (like Python) defaults to a global variable when it doesn't find a variable in scope - including for assignment. This is a bit troublesome because if you have a typo or renamed a variable you get wrong behavior and no error.

0

When you define a function inside another function, if you don't explicitly mark it as "local" it will be assigned to a global variable, i.e.

function b()
    print("goodbye!")
end
function a()
    function b()
        print("hello!")
    end
end
b() -- "goodbye!"
a() -- over-writes b
b() -- "hello!"

This is not a good thing.