| 405 | } |
| 406 | |
| 407 | void get_commands(color_ostream &con, std::vector<std::string> &commands) { |
| 408 | ConditionalCoreSuspender suspend{}; |
| 409 | |
| 410 | if (!suspend) { |
| 411 | con.printerr("Cannot acquire core lock in helpdb.get_commands\n"); |
| 412 | commands.clear(); |
| 413 | return; |
| 414 | } |
| 415 | |
| 416 | auto L = DFHack::Core::getInstance().getLuaState(); |
| 417 | Lua::StackUnwinder top(L); |
| 418 | |
| 419 | if (!lua_checkstack(L, 1) || |
| 420 | !Lua::PushModulePublic(con, L, "helpdb", "get_commands")) { |
| 421 | con.printerr("Failed to load helpdb Lua code\n"); |
| 422 | return; |
| 423 | } |
| 424 | |
| 425 | if (!Lua::SafeCall(con, L, 0, 1)) { |
| 426 | con.printerr("Failed Lua call to helpdb.get_commands.\n"); |
| 427 | } |
| 428 | |
| 429 | Lua::GetVector(L, commands, top + 1); |
| 430 | } |
| 431 | |
| 432 | static bool try_autocomplete(color_ostream &con, const std::string &first, std::string &completed) |
| 433 | { |
no test coverage detected