lua-users home
lua-l archive

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


string.byte('')  --> bad argument #2 to `byte' (out of range)

I don't feel that an empty string is an bad argument. I think to return
nil in this case is more usefull because:

if string.byte(s)==47 then ... end

Instead of:

if string.len(s)>0 and string.byte(s)==47 then ... end

Nearly all string functions can cope with nullstrings. Why
is string.byte() an exception?


--
Markus