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

Method is_builtin

library/Core.cpp:383–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383bool 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
407void get_commands(color_ostream &con, std::vector<std::string> &commands) {
408 ConditionalCoreSuspender suspend{};

Callers

nothing calls this directly

Calls 5

lua_checkstackFunction · 0.85
PushModulePublicFunction · 0.85
PushFunction · 0.85
SafeCallFunction · 0.85
lua_tobooleanFunction · 0.85

Tested by

no test coverage detected