MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / luaB_tostring

Function luaB_tostring

deps/lua/src/lbaselib.c:396–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394
395
396static int luaB_tostring (lua_State *L) {
397 luaL_checkany(L, 1);
398 if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */
399 return 1; /* use its value */
400 switch (lua_type(L, 1)) {
401 case LUA_TNUMBER:
402 lua_pushstring(L, lua_tostring(L, 1));
403 break;
404 case LUA_TSTRING:
405 lua_pushvalue(L, 1);
406 break;
407 case LUA_TBOOLEAN:
408 lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false"));
409 break;
410 case LUA_TNIL:
411 lua_pushliteral(L, "nil");
412 break;
413 default:
414 lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1));
415 break;
416 }
417 return 1;
418}
419
420
421static 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