Commit 20bda3d4 authored by Sinus Pi's avatar Sinus Pi
Browse files

Removed string casts.

UseTraceback is now a property.
Whitespace and brace standards and newlines adjusted.
parent 5086d380
......@@ -259,7 +259,7 @@ function luanet.each(o)
end
end
";
public bool use_traceback = false;
public bool UseTraceback { get; set; } = false;
#region Globals auto-complete
/// <summary>
......@@ -497,9 +497,9 @@ end
if (LuaLib.LuaLLoadBuffer(luaState, chunk, chunkName) == 0)
{
int errfunction=0;
if (use_traceback) {
errfunction=PushDebugTraceback(luaState, 0);
int errfunction = 0;
if (UseTraceback) {
errfunction = PushDebugTraceback(luaState, 0);
oldTop++;
}
......@@ -535,8 +535,7 @@ end
if (LuaLib.LuaLLoadBuffer(luaState, chunk, chunkName) == 0)
{
int errfunction = 0;
if (use_traceback)
{
if (UseTraceback) {
errfunction = PushDebugTraceback(luaState, 0);
oldTop++;
}
......@@ -571,8 +570,7 @@ end
executing = true;
int errfunction = 0;
if (use_traceback)
{
if (UseTraceback) {
errfunction = PushDebugTraceback(luaState, 0);
oldTop++;
}
......@@ -842,8 +840,7 @@ end
try {
int errfunction = 0;
if (use_traceback)
{
if (UseTraceback) {
errfunction = PushDebugTraceback(luaState, nArgs);
oldTop++;
}
......
......@@ -193,7 +193,7 @@ namespace NLua.Method
failedCall = false;
} catch (TargetInvocationException e) {
// Failure of method invocation
if (_Translator.interpreter.use_traceback) e.GetBaseException().Data["Traceback"] = _Translator.interpreter.GetDebugTraceback() as string;
if (_Translator.interpreter.UseTraceback) e.GetBaseException().Data["Traceback"] = _Translator.interpreter.GetDebugTraceback();
return SetPendingException (e.GetBaseException ());
} catch (Exception e) {
if (_Members.Length == 1) // Is the method overloaded?
......@@ -290,7 +290,7 @@ namespace NLua.Method
_Translator.Push (luaState, _LastCalledMethod.cachedMethod.Invoke (targetObject, _LastCalledMethod.args));
}
} catch (TargetInvocationException e) {
if (_Translator.interpreter.use_traceback) e.GetBaseException().Data["Traceback"] = _Translator.interpreter.GetDebugTraceback() as string;
if (_Translator.interpreter.UseTraceback) e.GetBaseException().Data["Traceback"] = _Translator.interpreter.GetDebugTraceback();
return SetPendingException (e.GetBaseException ());
} catch (Exception e) {
return SetPendingException (e);
......
......@@ -245,14 +245,14 @@ namespace NLua
if (message != null) {
// Wrap Lua error (just a string) and store the error location
if (interpreter.use_traceback) message += "\r\n"+interpreter.GetDebugTraceback() as string;
if (interpreter.UseTraceback) message += Environment.NewLine + interpreter.GetDebugTraceback();
e = new LuaScriptException (message, errLocation);
} else {
var ex = e as Exception;
if (ex != null) {
// Wrap generic .NET exception as an InnerException and store the error location
if (interpreter.use_traceback) ex.Data["Traceback"] = interpreter.GetDebugTraceback() as string;
if (interpreter.UseTraceback) ex.Data["Traceback"] = interpreter.GetDebugTraceback();
e = new LuaScriptException (ex, errLocation);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment