More descriptive error messages for lua console
This commit is contained in:
parent
65252aa002
commit
d8051926c8
@ -9,6 +9,7 @@ void luacon_open();
|
||||
int luacon_step();
|
||||
int luacon_keypress(char key);
|
||||
int luacon_eval(char *command);
|
||||
char *luacon_geterror();
|
||||
void luacon_close();
|
||||
int process_command_lua(pixel *vid_buf, char *console, char *console_error);
|
||||
|
||||
|
@ -24,6 +24,13 @@ int luacon_keypress(char key){
|
||||
int luacon_eval(char *command){
|
||||
return luaL_dostring (l, command);
|
||||
}
|
||||
char *luacon_geterror(){
|
||||
char *error = lua_tostring(l, -1);
|
||||
if(error==NULL || !error[0]){
|
||||
error = "failed to execute";
|
||||
}
|
||||
return error;
|
||||
}
|
||||
void luacon_close(){
|
||||
lua_close(l);
|
||||
}
|
||||
@ -44,7 +51,7 @@ int process_command_lua(pixel *vid_buf, char *console, char *console_error)
|
||||
} else {
|
||||
commandret = luacon_eval(console);
|
||||
if (commandret)
|
||||
strcpy(console_error,"failed to execute code.");
|
||||
strcpy(console_error, luacon_geterror());
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user