lua-users home
lua-l archive

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


Jon Akhtar wrote:
> To honor this I have been creating what are called "inspections" which
> find common flaws in code and either flag them, or flag them and offer
> to fix them.
> 
> [...] access of array index 0 [...]

This isn't necessarily a flaw. It's inefficient in Lua, but
there's no performance loss in LuaJIT (*). You may want to
separate these 'code smells' into categories that can be turned on
or off. Or maybe offer different profiles.

(*) The array part of LuaJIT tables is zero-based internally,
    but the visible semantics for {} and # stay the same.

--Mike