Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
20bda3d4
Commit
20bda3d4
authored
Sep 25, 2017
by
Sinus Pi
Browse files
Removed string casts.
UseTraceback is now a property. Whitespace and brace standards and newlines adjusted.
parent
5086d380
Changes
3
Hide whitespace changes
Inline
Side-by-side
Core/NLua/Lua.cs
View file @
20bda3d4
...
...
@@ -259,7 +259,7 @@ function luanet.each(o)
end
end
"
;
public
bool
u
se
_t
raceback
=
false
;
public
bool
U
se
T
raceback
{
get
;
set
;
}
=
false
;
#
region
Globals
auto
-
complete
/// <summary>
...
...
@@ -497,9 +497,9 @@ end
if
(
LuaLib
.
LuaLLoadBuffer
(
luaState
,
chunk
,
chunkName
)
==
0
)
{
int
errfunction
=
0
;
if
(
u
se
_t
raceback
)
{
errfunction
=
PushDebugTraceback
(
luaState
,
0
);
int
errfunction
=
0
;
if
(
U
se
T
raceback
)
{
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
++;
}
...
...
Core/NLua/Method/LuaMethodWrapper.cs
View file @
20bda3d4
...
...
@@ -193,7 +193,7 @@ namespace NLua.Method
failedCall
=
false
;
}
catch
(
TargetInvocationException
e
)
{
// Failure of method invocation
if
(
_Translator
.
interpreter
.
u
se
_t
raceback
)
e
.
GetBaseException
().
Data
[
"Traceback"
]
=
_Translator
.
interpreter
.
GetDebugTraceback
()
as
string
;
if
(
_Translator
.
interpreter
.
U
se
T
raceback
)
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
.
u
se
_t
raceback
)
e
.
GetBaseException
().
Data
[
"Traceback"
]
=
_Translator
.
interpreter
.
GetDebugTraceback
()
as
string
;
if
(
_Translator
.
interpreter
.
U
se
T
raceback
)
e
.
GetBaseException
().
Data
[
"Traceback"
]
=
_Translator
.
interpreter
.
GetDebugTraceback
();
return
SetPendingException
(
e
.
GetBaseException
());
}
catch
(
Exception
e
)
{
return
SetPendingException
(
e
);
...
...
Core/NLua/ObjectTranslator.cs
View file @
20bda3d4
...
...
@@ -245,14 +245,14 @@ namespace NLua
if
(
message
!=
null
)
{
// Wrap Lua error (just a string) and store the error location
if
(
interpreter
.
u
se
_t
raceback
)
message
+=
"\r\n"
+
interpreter
.
GetDebugTraceback
()
as
string
;
if
(
interpreter
.
U
se
T
raceback
)
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
.
u
se
_t
raceback
)
ex
.
Data
[
"Traceback"
]
=
interpreter
.
GetDebugTraceback
()
as
string
;
if
(
interpreter
.
U
se
T
raceback
)
ex
.
Data
[
"Traceback"
]
=
interpreter
.
GetDebugTraceback
();
e
=
new
LuaScriptException
(
ex
,
errLocation
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment