** Prints (calling the Lua 'print' function) any values on the stack */
| 584 | ** Prints (calling the Lua 'print' function) any values on the stack |
| 585 | */ |
| 586 | static void l_print (lua_State *L) { |
| 587 | int n = lua_gettop(L); |
| 588 | if (n > 0) { /* any result to be printed? */ |
| 589 | luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); |
| 590 | lua_getglobal(L, "print"); |
| 591 | lua_insert(L, 1); |
| 592 | if (lua_pcall(L, n, 0, 0) != LUA_OK) |
| 593 | l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", |
| 594 | lua_tostring(L, -1))); |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | |
| 599 | /* |
no test coverage detected