MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaB_tostring

Function luaB_tostring

Source/Misc/lua/src/lua.c:11260–11282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

luaL_checkanyFunction · 0.85
luaL_callmetaFunction · 0.85
lua_typeFunction · 0.85
lua_pushstringFunction · 0.85
lua_pushvalueFunction · 0.85
lua_tobooleanFunction · 0.85
lua_pushfstringFunction · 0.85
lua_topointerFunction · 0.85

Tested by

no test coverage detected