> array offsets are a matter of convention. Lua chooses 1 as the first element of an array instead of 0. But that is just convention. Your code could use 0 or -100.
Not sure what your point is here. Lua arrays start at 1. If you disobey this rule, your table isn't really an array and the length operator will be undefined starting in Lua 5.2.
Sure you could disobey this rule and create an array that starts at -100. You can do the same in C:
// Array whose indices start at -100:
char *funky_array = (char*)malloc(n * sizeof(char)) + 100;
> It's a cheap hack to conflate everything into one table data structure.
You say "cheap hack" I say "brilliant optimization." Show me an equally-capable language that has a <100kb interpreter and performs as well as Lua. Lua fulfills its design goals brilliantly.
Not sure what your point is here. Lua arrays start at 1. If you disobey this rule, your table isn't really an array and the length operator will be undefined starting in Lua 5.2.
Sure you could disobey this rule and create an array that starts at -100. You can do the same in C:
> It's a cheap hack to conflate everything into one table data structure.You say "cheap hack" I say "brilliant optimization." Show me an equally-capable language that has a <100kb interpreter and performs as well as Lua. Lua fulfills its design goals brilliantly.