| 987 | } |
| 988 | |
| 989 | static bool get_options(color_ostream &out, |
| 990 | dig_now_options &opts, |
| 991 | const std::vector<std::string> ¶meters) { |
| 992 | auto L = DFHack::Core::getInstance().getLuaState(); |
| 993 | Lua::StackUnwinder top(L); |
| 994 | |
| 995 | if (!lua_checkstack(L, parameters.size() + 2) || |
| 996 | !Lua::PushModulePublic( |
| 997 | out, L, "plugins.dig-now", "parse_commandline")) { |
| 998 | out.printerr("Failed to load dig-now Lua code\n"); |
| 999 | return false; |
| 1000 | } |
| 1001 | |
| 1002 | Lua::Push(L, &opts); |
| 1003 | |
| 1004 | for (const std::string ¶m : parameters) |
| 1005 | Lua::Push(L, param); |
| 1006 | |
| 1007 | if (!Lua::SafeCall(out, L, parameters.size() + 1, 0)) |
| 1008 | return false; |
| 1009 | |
| 1010 | return true; |
| 1011 | } |
| 1012 | |
| 1013 | bool dig_now_impl(color_ostream &out, const dig_now_options &options) { |
| 1014 | if (!Maps::IsValid()) { |
no test coverage detected