lua-users home
lua-l archive

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


Only numbers and strings are interchangeable because only a string can be converted to a number -- and only then, it's based on the string -- so because strings can go to numbers, it was decided that only numbers can go to strings.

On Mon, Jul 4, 2016 at 5:41 AM Viacheslav Usov <via.usov@gmail.com> wrote:
On Mon, Jul 4, 2016 at 4:19 AM, 书呆彭, Peng Yi <nerditation@outlook.com> wrote:

> the fact that `lua_tolstring` also accept a number value is just a side effect of the way Lua coerce number and string.

Fair enough. Then the question is, why is coercion of Boolean into string is not part of the language?

Unless I am missing something, that seems rather arbitrary to me.

Cheers,
V.
--