lua-users home
lua-l archive

Re: string.byte()

[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:
	It isn't. The bad argument is nil where you should
use a number to indicate the position at the string. See the
manual:
string.byte (s [, i])
Returns the internal numerical code of the i-th character of s. If i is absent, then it is assumed to be 1. i may be negative.
	Tomas

AltStyle によって変換されたページ (->オリジナル) /