lua-users home
lua-l archive

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


> Sorry if this has been discussed many times before, if it has, I
> couldn't find it...
> 
> >print(type(string.byte("")))
> =>stdin:1: bad argument #1 to 'type' (value expected)
> 
> Shouldn't string.byte return nil for an empty string?

string.byte has a variable number of returns, and the maximum number
is the string length (returning all characters):

> =string.byte("ab", 1, 5)
97      98
> =string.byte("a", 1, 2)
97

It seems natural that, when the string size is zero, it returns zero
values.

-- Roberto