[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Nil and false in Lua design
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 14 Oct 2013 21:17:20 +0200
2013/10/14 Andrew Starks <andrew.starks@trms.com>:
> So, when I see `tostring(x)`, I expect that there is also `tonumber`
> and `toboolean` and even `tonil` or totable, as nonsensical as the
> last two might seem/be.
'tostring' is there so that humans can read its output. 'tonumber' is
there because something else except a number can sometimes
be converted to a number. 'totable' is not there because a table
is a Swiss army knife, you don't know beforehand which blade
to use. Most of the other possibilities are in fact present in the
API. The full list is:
lua_toboolean
lua_tocfunction
lua_tointeger
lua_tointegerx
lua_tolstring
lua_tonumber
lua_tonumberx
lua_topointer
lua_tostring
lua_tothread
lua_tounsigned
lua_tounsignedx
lua_touserdata
This is misleading though since those 'to' functions actually
convert to C types.
- References:
- Nil and false in Lua design, Alexander Gladysh
- Re: Nil and false in Lua design, Coda Highland
- Re: Nil and false in Lua design, Luiz Henrique de Figueiredo
- Re: Nil and false in Lua design, Thomas Jericke
- Re: Nil and false in Lua design, steve donovan
- Re: Nil and false in Lua design, Dirk Laurie
- Re: Nil and false in Lua design, Carsten Fuchs
- Re: Nil and false in Lua design, Thomas Jericke
- Re: Nil and false in Lua design, steve donovan
- Re: Nil and false in Lua design, Carsten Fuchs
- Re: Nil and false in Lua design, steve donovan
- Re: Nil and false in Lua design, Andrew Starks