lua-users home
lua-l archive

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

> And the builtin `string.byte(index)` function SHOULD also be fixed to return a true `nil` for a given index past the end of string, and not an empty list (or this should not make any difference for calling type()).

string.byte can return multiple values depending on the i and j arguments, meaning that it dynamically returns values. If there are no values to return, string.byte signals Lua that it has placed 0 values on the stack upon return. 

type requires any value, so not LUA_TNONE. The fact that "none" gets coerced to "nil" upon assignment (because otherwise the assignment breaks), doesn't really mean that a call like you describe should work in my honest opinion.

I may misunderstand, however that's how I've always seen it.