| 381 | } |
| 382 | |
| 383 | bool DFHack::is_builtin(color_ostream& con, const std::string& command) |
| 384 | { |
| 385 | CoreSuspender suspend; |
| 386 | auto L = DFHack::Core::getInstance().getLuaState(); |
| 387 | Lua::StackUnwinder top(L); |
| 388 | |
| 389 | if (!lua_checkstack(L, 1) || |
| 390 | !Lua::PushModulePublic(con, L, "helpdb", "is_builtin")) |
| 391 | { |
| 392 | con.printerr("Failed to load helpdb Lua code\n"); |
| 393 | return false; |
| 394 | } |
| 395 | |
| 396 | Lua::Push(L, command); |
| 397 | |
| 398 | if (!Lua::SafeCall(con, L, 1, 1)) |
| 399 | { |
| 400 | con.printerr("Failed Lua call to helpdb.is_builtin.\n"); |
| 401 | return false; |
| 402 | } |
| 403 | |
| 404 | return lua_toboolean(L, -1); |
| 405 | } |
| 406 | |
| 407 | void get_commands(color_ostream &con, std::vector<std::string> &commands) { |
| 408 | ConditionalCoreSuspender suspend{}; |
nothing calls this directly
no test coverage detected