** Prints (calling the Lua 'print' function) any values on the stack */
| 271 | ** Prints (calling the Lua 'print' function) any values on the stack |
| 272 | */ |
| 273 | static void l_print(lua_State *L) { |
| 274 | int n = lua_gettop(L); |
| 275 | if (n > 0) { /* any result to be printed? */ |
| 276 | luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); |
| 277 | lua_getglobal(L, "print"); |
| 278 | lua_insert(L, 1); |
| 279 | if (lua_pcall(L, n, 0, 0) != LUA_OK) |
| 280 | ll_message(L, progname, lua_pushfstring(L, "error calling 'print' (%s)", |
| 281 | lua_tostring(L, -1))); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | |
| 286 | /* |
no test coverage detected