** Prints (calling the Lua 'print' function) any values on the stack */
| 386 | ** Prints (calling the Lua 'print' function) any values on the stack |
| 387 | */ |
| 388 | static void l_print (lua_State *L) { |
| 389 | int n = lua_gettop(L); |
| 390 | if (n > 0) { /* any result to be printed? */ |
| 391 | luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); |
| 392 | lua_getglobal(L, "print"); |
| 393 | lua_insert(L, 1); |
| 394 | if (lua_pcall(L, n, 0, 0) != LUA_OK) |
| 395 | l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", |
| 396 | lua_tostring(L, -1))); |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | |
| 401 | /* |
no test coverage detected