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

Function do_command

plugins/aquifer.cpp:36–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36static command_result do_command(color_ostream &out, vector<string> &parameters) {
37 if (!Core::getInstance().isMapLoaded()) {
38 out.printerr("Cannot run {} without a loaded map.\n", plugin_name);
39 return CR_FAILURE;
40 }
41
42 bool show_help = false;
43 if (!Lua::CallLuaModuleFunction(out, "plugins.aquifer", "parse_commandline", std::make_tuple(parameters),
44 1, [&](lua_State *L) {
45 show_help = !lua_toboolean(L, 1);
46 })) {
47 return CR_FAILURE;
48 }
49
50 return show_help ? CR_WRONG_USAGE : CR_OK;
51}
52
53////////////////////////////////////
54// Lua API

Callers

nothing calls this directly

Calls 2

CallLuaModuleFunctionFunction · 0.85
lua_tobooleanFunction · 0.85

Tested by

no test coverage detected