lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Jun 18, 2012 at 02:21:57AM -0700, Patrick Masotta wrote:
> I’m new to LUA but I have good programming experince..
> 1) I couldn’t believe when I saw LUA arrays indexed from “1”; that’s for kids not for programmers. 

No, arrays are not 1 based. You can write a[0] and it does what you
think it does. Then, the standard implementation of Lua is more
efficient if you use the range 1..n instead of the range 0..n-1, but
IIRC other implementations do not behave like that because this is a
detail of the implementation, it is not part of the Lua language.

You should really think Lua has no array, it has just (hash) tables.

Cheers
-- 
Enrico Tassi