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

Function luaB_print

Source/Misc/lua/src/lua.c:10895–10914  ·  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

10893** (a console window or a log file, for instance).
10894*/
10895static int luaB_print (lua_State *L) {
10896int n = lua_gettop(L); /* number of arguments */
10897int i;
10898lua_getglobal(L, "tostring");
10899for (i=1; i<=n; i++) {
10900const char *s;
10901lua_pushvalue(L, -1); /* function to be called */
10902lua_pushvalue(L, i); /* value to print */
10903lua_call(L, 1, 1);
10904s = lua_tostring(L, -1); /* get result */
10905if (s == NULL)
10906return luaL_error(L, LUA_QL("tostring") " must return a string to "
10907LUA_QL("print"));
10908if (i>1) fputs("\t", stdout);
10909fputs(s, stdout);
10910lua_pop(L, 1); /* pop result */
10911}
10912fputs("\n", stdout);
10913return 0;
10914}
10915
10916
10917static int luaB_tonumber (lua_State *L) {

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
lua_pushvalueFunction · 0.85
lua_callFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected