Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a8e5383

Browse files
committed
use new CallLuaModuleFunction overload
1 parent a62876c commit a8e5383

1 file changed

Lines changed: 1 addition & 25 deletions

File tree

plugins/tailor.cpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -709,26 +709,6 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
709709
return CR_OK;
710710
}
711711

712-
static bool call_tailor_lua(color_ostream *out, const char *fn_name,
713-
int nargs = 0, int nres = 0,
714-
Lua::LuaLambda && args_lambda = Lua::DEFAULT_LUA_LAMBDA,
715-
Lua::LuaLambda && res_lambda = Lua::DEFAULT_LUA_LAMBDA) {
716-
if (!out)
717-
out = &Core::getInstance().getConsole();
718-
719-
DEBUG(control,*out).print("calling tailor lua function: '%s'\n", fn_name);
720-
721-
CoreSuspender guard;
722-
723-
auto L = Lua::Core::State;
724-
Lua::StackUnwinder top(L);
725-
726-
return Lua::CallLuaModuleFunction(*out, L, "plugins.tailor", fn_name,
727-
nargs, nres,
728-
std::forward<Lua::LuaLambda&&>(args_lambda),
729-
std::forward<Lua::LuaLambda&&>(res_lambda));
730-
}
731-
732712
static command_result do_command(color_ostream &out, vector<string> &parameters) {
733713
CoreSuspender suspend;
734714

@@ -738,11 +718,7 @@ static command_result do_command(color_ostream &out, vector<string> &parameters)
738718
}
739719

740720
bool show_help = false;
741-
if (!call_tailor_lua(&out, "parse_commandline", parameters.size(), 1,
742-
[&](lua_State *L) {
743-
for (const string &param : parameters)
744-
Lua::Push(L, param);
745-
},
721+
if (!Lua::CallLuaModuleFunction(out, "plugins.tailor", "parse_commandline", parameters, 1,
746722
[&](lua_State *L) {
747723
show_help = !lua_toboolean(L, -1);
748724
})) {

0 commit comments

Comments
 (0)