mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
executor_func update
This commit is contained in:
parent
172cfe4ec9
commit
9dc3c40b69
1 changed files with 5 additions and 3 deletions
|
|
@ -23,6 +23,7 @@ namespace cmd {
|
|||
};
|
||||
|
||||
class Command;
|
||||
class CommandsInterpreter;
|
||||
|
||||
struct Prompt {
|
||||
Command* command;
|
||||
|
|
@ -31,6 +32,7 @@ namespace cmd {
|
|||
};
|
||||
|
||||
using executor_func = std::function<dynamic::Value(
|
||||
CommandsInterpreter*,
|
||||
dynamic::List_sptr args,
|
||||
dynamic::Map_sptr kwargs
|
||||
)>;
|
||||
|
|
@ -67,8 +69,8 @@ namespace cmd {
|
|||
return &found->second;
|
||||
}
|
||||
|
||||
dynamic::Value execute(const Prompt& prompt) {
|
||||
return executor(prompt.args, prompt.kwargs);
|
||||
dynamic::Value execute(CommandsInterpreter* interpreter, const Prompt& prompt) {
|
||||
return executor(interpreter, prompt.args, prompt.kwargs);
|
||||
}
|
||||
|
||||
const std::string& getName() const {
|
||||
|
|
@ -99,7 +101,7 @@ namespace cmd {
|
|||
}
|
||||
|
||||
dynamic::Value execute(const Prompt& prompt) {
|
||||
return prompt.command->execute(prompt);
|
||||
return prompt.command->execute(this, prompt);
|
||||
}
|
||||
|
||||
dynamic::Value& operator[](const std::string& name) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue