mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 23:11:49 +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 Command;
|
||||||
|
class CommandsInterpreter;
|
||||||
|
|
||||||
struct Prompt {
|
struct Prompt {
|
||||||
Command* command;
|
Command* command;
|
||||||
|
|
@ -31,6 +32,7 @@ namespace cmd {
|
||||||
};
|
};
|
||||||
|
|
||||||
using executor_func = std::function<dynamic::Value(
|
using executor_func = std::function<dynamic::Value(
|
||||||
|
CommandsInterpreter*,
|
||||||
dynamic::List_sptr args,
|
dynamic::List_sptr args,
|
||||||
dynamic::Map_sptr kwargs
|
dynamic::Map_sptr kwargs
|
||||||
)>;
|
)>;
|
||||||
|
|
@ -67,8 +69,8 @@ namespace cmd {
|
||||||
return &found->second;
|
return &found->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic::Value execute(const Prompt& prompt) {
|
dynamic::Value execute(CommandsInterpreter* interpreter, const Prompt& prompt) {
|
||||||
return executor(prompt.args, prompt.kwargs);
|
return executor(interpreter, prompt.args, prompt.kwargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& getName() const {
|
const std::string& getName() const {
|
||||||
|
|
@ -99,7 +101,7 @@ namespace cmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic::Value execute(const Prompt& prompt) {
|
dynamic::Value execute(const Prompt& prompt) {
|
||||||
return prompt.command->execute(prompt);
|
return prompt.command->execute(this, prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic::Value& operator[](const std::string& name) {
|
dynamic::Value& operator[](const std::string& name) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue