[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string.byte with empty string
- From: Alexander Gladysh <agladysh@...>
- Date: Sun, 25 Jan 2009 00:08:21 +0300
> 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.
In Lua "to return zero values" is the same as to return nil. "No
value" is artifact of C API.
In my experience distinction between "no value" and nil is confusing.
Especially for users who write in Lua and do not care about C
implementation.
Why core Lua libraries handle "nil" and "no value" separately?
Alexander.