** Prints (calling the Lua 'print' function) any values on the stack */
| 533 | ** Prints (calling the Lua 'print' function) any values on the stack |
| 534 | */ |
| 535 | static void l_print (lua_State *L) { |
| 536 | int n = lua_gettop(L); |
| 537 | if (n > 0) { /* any result to be printed? */ |
| 538 | luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); |
| 539 | lua_getglobal(L, "print"); |
| 540 | lua_insert(L, 1); |
| 541 | if (lua_pcall(L, n, 0, 0) != LUA_OK) |
| 542 | l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", |
| 543 | lua_tostring(L, -1))); |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | |
| 548 | /* |
no test coverage detected