** Prints (calling the Lua 'print' function) any values on the stack */
| 128 | ** Prints (calling the Lua 'print' function) any values on the stack |
| 129 | */ |
| 130 | static void l_print(lua_State *L) |
| 131 | { |
| 132 | int n = lua_gettop(L); |
| 133 | if (n > 0) { /* any result to be printed? */ |
| 134 | luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); |
| 135 | lua_getglobal(L, "print"); |
| 136 | lua_insert(L, 1); |
| 137 | if (lua_pcall(L, n, 0, 0) != LUA_OK) |
| 138 | loge(LUA, lua_pushfstring(L, "error calling 'print' (%s)", lua_tostring(L, -1))); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /* |
| 143 | ** Try to compile line on the stack as 'return <line>;'; on return, stack |
no test coverage detected