MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaB_print

Function luaB_print

other_src/lua/src/lbaselib.cpp:31–50  ·  view source on GitHub ↗

** If your system does not support `stdout', you can just remove this function. ** If you need, you can define your own `print' function, following this ** model but changing `fputs' to put the strings at a proper place ** (a console window or a log file, for instance). */

Source from the content-addressed store, hash-verified

29** (a console window or a log file, for instance).
30*/
31static int luaB_print (lua_State *L) {
32 int n = lua_gettop(L); /* number of arguments */
33 int i;
34 lua_getglobal(L, "tostring");
35 for (i=1; i<=n; i++) {
36 const char *s;
37 lua_pushvalue(L, -1); /* function to be called */
38 lua_pushvalue(L, i); /* value to print */
39 lua_call(L, 1, 1);
40 s = lua_tostring(L, -1); /* get result */
41 if (s == NULL)
42 return luaL_error(L, LUA_QL("tostring") " must return a string to "
43 LUA_QL("print"));
44 if (i>1) fputs("\t", stdout);
45 fputs(s, stdout);
46 lua_pop(L, 1); /* pop result */
47 }
48 fputs("\n", stdout);
49 return 0;
50}
51
52
53static int luaB_tonumber (lua_State *L) {

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.70
lua_pushvalueFunction · 0.70
lua_callFunction · 0.70
luaL_errorFunction · 0.70

Tested by

no test coverage detected