| 316 | } |
| 317 | |
| 318 | static Console *get_console(lua_State *state) |
| 319 | { |
| 320 | color_ostream *pstream = Lua::GetOutput(state); |
| 321 | |
| 322 | if (!pstream) |
| 323 | { |
| 324 | lua_pushnil(state); |
| 325 | lua_pushstring(state, "no output stream"); |
| 326 | return NULL; |
| 327 | } |
| 328 | |
| 329 | if (!pstream->is_console()) |
| 330 | { |
| 331 | lua_pushnil(state); |
| 332 | lua_pushstring(state, "not an interactive console"); |
| 333 | return NULL; |
| 334 | } |
| 335 | |
| 336 | return static_cast<Console*>(pstream); |
| 337 | } |
| 338 | |
| 339 | static int DFHACK_TOSTRING_TOKEN = 0; |
| 340 |
no test coverage detected