mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 14:01:49 +00:00
update console.execute output on parsing error
This commit is contained in:
parent
467b4ad043
commit
3156e40c17
1 changed files with 10 additions and 3 deletions
|
|
@ -31,9 +31,16 @@ static int l_add_command(lua::State* L) {
|
||||||
|
|
||||||
static int l_execute(lua::State* L) {
|
static int l_execute(lua::State* L) {
|
||||||
auto prompt = lua::require_string(L, 1);
|
auto prompt = lua::require_string(L, 1);
|
||||||
auto result = engine->getCommandsInterpreter()->execute(prompt);
|
try {
|
||||||
lua::pushvalue(L, result);
|
auto result = engine->getCommandsInterpreter()->execute(prompt);
|
||||||
return 1;
|
lua::pushvalue(L, result);
|
||||||
|
return 1;
|
||||||
|
} catch (const parsing_error& err) {
|
||||||
|
if (std::string(err.what()).find("unknown command ") == 0) {
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
throw std::runtime_error(err.errorLog());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_set(lua::State* L) {
|
static int l_set(lua::State* L) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue