** Prints (calling the Lua 'print' function) any values on the stack */
| 658 | ** Prints (calling the Lua 'print' function) any values on the stack |
| 659 | */ |
| 660 | static void l_print (lua_State *L) { |
| 661 | int n = lua_gettop(L); |
| 662 | if (n > 0) { /* any result to be printed? */ |
| 663 | luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); |
| 664 | lua_getglobal(L, "print"); |
| 665 | lua_insert(L, 1); |
| 666 | if (lua_pcall(L, n, 0, 0) != LUA_OK) |
| 667 | l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", |
| 668 | lua_tostring(L, -1))); |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | |
| 673 | /* |
no test coverage detected