lua-users home
lua-l archive

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


In my opinion we should bring back the old compromise of starting arrays at 0.5

I was going to make that argument. It's not about counting, it's about indexing and when you think about lining up objects on a tape, the first item starts at position 0 and stops at position 1 -- I hope there is no doubt about that. As the first centimeter on the tape starts at zero and stops at centimeter one. The question in addressing is then, do you specify start or stop positions. And actually one can make an argument to specify the middle.. and this is exactly what HTML5 canvas does. If you want to draw the top pixel line, it's position is 0.5 -- as long devicePixelRatio is 1 to keep things not extra complicated, which they can on nowadays common HiPDI screens. But do be fair, HTML5 canvas wanted to abstract Pixels away, that's way the result if one want to draw a line on a pixel boundary, the result is the somewhat comically n dot 5.

@Dirk, well about retelling old jokes: Okay, so at those times when most people where doing stuff by using only ones and zeros, you only used ones.