lua-users home
lua-l archive

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


Sam Roberts skrev:
[...]
So, calling lua_tostring() on a value that had a __tostring metamethod
would remove it from the stack, replacing it with a string. Some people
already don't like auto-coercions between number and string, can you
imagine the trouble it would cause to have your user-data auto-coerced
to strings? :-(

This is not a problem. The only place the user-data or other type will be replaced with a string is in the stack where the string.format routine collects it's arguments. The original value will remain the same, at another safe location in the stack.

//Andreas