Open robnorr opened 2 years ago
To me the error looks like normal lua error, which is formatted by lua and sol just captures the final string and gives it to you. So unless you modify/tap into the error handling of lua I suspect you would not be able to get the parts separately.
From a sol::protected_function_result, I do the following to check for, and get error messages:
This gives a nicely formatted message such as:
What I'm wondering is if it's possible to get (from either the
protected_function_result
, or from theerror
, or from some other object) the line number (3
) and the error message'(' expected near 'foo'
separately? The main purpose for this is to highlight the line where the error occurs in an embedded script window, so preferably the number would come as a int type rather than a string type. If there is nothing built-in to sol I can of course extract the line number with regex, but I wanted to first check if there is a neater solution