refactor: add GUI instance reference to UI nodes
This commit is contained in:
@@ -14,7 +14,7 @@ static int l_add_command(lua::State* L) {
|
||||
lua::pushvalue(L, 3);
|
||||
auto func = lua::create_lambda(L);
|
||||
try {
|
||||
engine->getCommandsInterpreter()->getRepository()->add(
|
||||
engine->getCmd().getRepository()->add(
|
||||
scheme,
|
||||
description,
|
||||
[func](auto, auto args, auto kwargs) {
|
||||
@@ -32,7 +32,7 @@ static int l_add_command(lua::State* L) {
|
||||
static int l_execute(lua::State* L) {
|
||||
auto prompt = lua::require_string(L, 1);
|
||||
try {
|
||||
auto result = engine->getCommandsInterpreter()->execute(prompt);
|
||||
auto result = engine->getCmd().execute(prompt);
|
||||
lua::pushvalue(L, result);
|
||||
return 1;
|
||||
} catch (const parsing_error& err) {
|
||||
@@ -45,19 +45,18 @@ static int l_execute(lua::State* L) {
|
||||
|
||||
static int l_get(lua::State* L) {
|
||||
auto name = lua::require_string(L, 1);
|
||||
return lua::pushvalue(L, (*engine->getCommandsInterpreter())[name]);
|
||||
return lua::pushvalue(L, engine->getCmd()[name]);
|
||||
}
|
||||
|
||||
static int l_set(lua::State* L) {
|
||||
auto name = lua::require_string(L, 1);
|
||||
auto value = lua::tovalue(L, 2);
|
||||
(*engine->getCommandsInterpreter())[name] = value;
|
||||
engine->getCmd()[name] = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_get_commands_list(lua::State* L) {
|
||||
auto interpreter = engine->getCommandsInterpreter();
|
||||
auto repo = interpreter->getRepository();
|
||||
auto repo = engine->getCmd().getRepository();
|
||||
const auto& commands = repo->getCommands();
|
||||
|
||||
lua::createtable(L, commands.size(), 0);
|
||||
@@ -71,8 +70,7 @@ static int l_get_commands_list(lua::State* L) {
|
||||
|
||||
static int l_get_command_info(lua::State* L) {
|
||||
auto name = lua::require_string(L, 1);
|
||||
auto interpreter = engine->getCommandsInterpreter();
|
||||
auto repo = interpreter->getRepository();
|
||||
auto repo = engine->getCmd().getRepository();
|
||||
auto command = repo->get(name);
|
||||
if (command == nullptr) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user