lua-users home
lua-l archive

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


on 6/29/06 1:46 PM, Diego Nehab at diego@tecgraf.puc-rio.br wrote:

> This brings it closer to the behavior of lua_touserdata on
> something that is not a userdata. Perhaps things should be
> more orthogonal. Add a __tostring that would be always invoked
> by lua_tostring (this would replace the element in the
> stack). And then have a lua_rawtostring that would just
> return NULL for non-strings...

Perhaps lua_tostring should access the string without conversion (or perhaps
lua_rawtostring) while luaL_tostring would invoke the same logic as the Lua
tostring function (and probably change the stack slot along the way).

Are there really that many cases where it is useful to convert numbers to
strings without converting other types? I would love, for example, to have a
character in string.format's format string that would mean "run the argument
through tostring".

Mark