MCPcopy Create free account
hub / github.com/crownengine/crown / l_print

Function l_print

src/lua/lua_environment.cpp:130–140  ·  view source on GitHub ↗

** Prints (calling the Lua 'print' function) any values on the stack */

Source from the content-addressed store, hash-verified

128** Prints (calling the Lua 'print' function) any values on the stack
129*/
130static void l_print(lua_State *L)
131{
132 int n = lua_gettop(L);
133 if (n > 0) { /* any result to be printed? */
134 luaL_checkstack(L, LUA_MINSTACK, "too many results to print");
135 lua_getglobal(L, "print");
136 lua_insert(L, 1);
137 if (lua_pcall(L, n, 0, 0) != LUA_OK)
138 loge(LUA, lua_pushfstring(L, "error calling 'print' (%s)", lua_tostring(L, -1)));
139 }
140}
141
142/*
143** Try to compile line on the stack as 'return <line>;'; on return, stack

Callers 1

do_REPLFunction · 0.85

Calls 5

lua_gettopFunction · 0.50
luaL_checkstackFunction · 0.50
lua_insertFunction · 0.50
lua_pcallFunction · 0.50
lua_pushfstringFunction · 0.50

Tested by

no test coverage detected