MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaL_tolstring

Function luaL_tolstring

third-party/lua-5.2.4/src/lauxlib.c:737–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735
736
737LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
738 if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */
739 switch (lua_type(L, idx)) {
740 case LUA_TNUMBER:
741 case LUA_TSTRING:
742 lua_pushvalue(L, idx);
743 break;
744 case LUA_TBOOLEAN:
745 lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false"));
746 break;
747 case LUA_TNIL:
748 lua_pushliteral(L, "nil");
749 break;
750 default:
751 lua_pushfstring(L, "%s: %p", luaL_typename(L, idx),
752 lua_topointer(L, idx));
753 break;
754 }
755 }
756 return lua_tolstring(L, -1, len);
757}
758
759
760/*

Callers 2

luaB_tostringFunction · 0.70
str_formatFunction · 0.70

Calls 8

luaL_callmetaFunction · 0.70
lua_typeFunction · 0.70
lua_pushvalueFunction · 0.70
lua_pushstringFunction · 0.70
lua_tobooleanFunction · 0.70
lua_pushfstringFunction · 0.70
lua_topointerFunction · 0.70
lua_tolstringFunction · 0.70

Tested by

no test coverage detected