lua-users home
lua-l archive

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

On 06/03/2010 20:40, joao lobato wrote:
I suppose it would be better all around if string.sub only accepted
non-null integers as indices

Yes, but unlike some languages like Java, which prefer to hold the hand of users (might be useful in large projects, I reckon), Lua's philosophy, not unlike C's one, is: "garbage in, garbage out". Ie. most functions just don't check validity of input, relying on intelligence of programmers to provide valid data. At the risk of crashing or having undefined behavior (security breaches...). But skipping such checking was valuable on 1MHz processors, meaning higher speed. :-)

Philippe Lhoste
--  (near) Paris -- France
--  --  --  --  --  --  --  --  --  --  --  --  --  --