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

Function luaB_print

third-party/lua-5.2.4/src/lbaselib.c:23–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23static int luaB_print (lua_State *L) {
24 int n = lua_gettop(L); /* number of arguments */
25 int i;
26 lua_getglobal(L, "tostring");
27 for (i=1; i<=n; i++) {
28 const char *s;
29 size_t l;
30 lua_pushvalue(L, -1); /* function to be called */
31 lua_pushvalue(L, i); /* value to print */
32 lua_call(L, 1, 1);
33 s = lua_tolstring(L, -1, &l); /* get result */
34 if (s == NULL)
35 return luaL_error(L,
36 LUA_QL("tostring") " must return a string to " LUA_QL("print"));
37 if (i>1) luai_writestring("\t", 1);
38 luai_writestring(s, l);
39 lua_pop(L, 1); /* pop result */
40 }
41 luai_writeline();
42 return 0;
43}
44
45
46#define SPACECHARS " \f\n\r\t\v"

Callers

nothing calls this directly

Calls 6

lua_gettopFunction · 0.70
lua_getglobalFunction · 0.70
lua_pushvalueFunction · 0.70
lua_tolstringFunction · 0.70
luaL_errorFunction · 0.70
lua_callFunction · 0.50

Tested by

no test coverage detected