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

Function do_command

plugins/preserve-rooms.cpp:266–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266static command_result do_command(color_ostream &out, vector<string> &parameters) {
267 if (!World::isFortressMode() || !Core::getInstance().isMapLoaded()) {
268 out.printerr("Cannot run {} without a loaded fort.\n", plugin_name);
269 return CR_FAILURE;
270 }
271
272 bool show_help = false;
273 if (!Lua::CallLuaModuleFunction(out, "plugins.preserve-rooms", "parse_commandline", std::make_tuple(parameters),
274 1, [&](lua_State *L) {
275 show_help = !lua_toboolean(L, -1);
276 })) {
277 return CR_FAILURE;
278 }
279
280 return show_help ? CR_WRONG_USAGE : CR_OK;
281}
282
283/////////////////////////////////////////////////////
284// cycle logic

Callers

nothing calls this directly

Calls 2

CallLuaModuleFunctionFunction · 0.85
lua_tobooleanFunction · 0.85

Tested by

no test coverage detected