| 11258 | |
| 11259 | |
| 11260 | static int luaB_tostring (lua_State *L) { |
| 11261 | luaL_checkany(L, 1); |
| 11262 | if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ |
| 11263 | return 1; /* use its value */ |
| 11264 | switch (lua_type(L, 1)) { |
| 11265 | case LUA_TNUMBER: |
| 11266 | lua_pushstring(L, lua_tostring(L, 1)); |
| 11267 | break; |
| 11268 | case LUA_TSTRING: |
| 11269 | lua_pushvalue(L, 1); |
| 11270 | break; |
| 11271 | case LUA_TBOOLEAN: |
| 11272 | lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false")); |
| 11273 | break; |
| 11274 | case LUA_TNIL: |
| 11275 | lua_pushliteral(L, "nil"); |
| 11276 | break; |
| 11277 | default: |
| 11278 | lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); |
| 11279 | break; |
| 11280 | } |
| 11281 | return 1; |
| 11282 | } |
| 11283 | |
| 11284 | |
| 11285 | static int luaB_newproxy (lua_State *L) { |
nothing calls this directly
no test coverage detected