MCPcopy Create free account
hub / github.com/DFHack/dfhack / get_commands

Function get_commands

library/Core.cpp:407–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407void 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
432static bool try_autocomplete(color_ostream &con, const std::string &first, std::string &completed)
433{

Callers 1

try_autocompleteFunction · 0.85

Calls 5

lua_checkstackFunction · 0.85
PushModulePublicFunction · 0.85
SafeCallFunction · 0.85
GetVectorFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected