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
e198d37f
Commit
e198d37f
authored
Dec 22, 2014
by
Isaac Brodsky
Browse files
Whitespace only change
parent
3da6e77c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Core/NLua/Metatables.cs
View file @
e198d37f
...
@@ -1096,7 +1096,7 @@ namespace NLua
...
@@ -1096,7 +1096,7 @@ namespace NLua
LuaLib
.
LuaRemove
(
luaState
,
1
);
LuaLib
.
LuaRemove
(
luaState
,
1
);
var
constructors
=
klass
.
UnderlyingSystemType
.
GetConstructors
();
var
constructors
=
klass
.
UnderlyingSystemType
.
GetConstructors
();
foreach
(
var
constructor
in
constructors
)
{
foreach
(
var
constructor
in
constructors
)
{
bool
isConstructor
=
MatchParameters
(
luaState
,
constructor
,
ref
validConstructor
);
bool
isConstructor
=
MatchParameters
(
luaState
,
constructor
,
ref
validConstructor
);
...
@@ -1113,16 +1113,16 @@ namespace NLua
...
@@ -1113,16 +1113,16 @@ namespace NLua
return
1
;
return
1
;
}
}
}
}
if
(
klass
.
UnderlyingSystemType
.
IsValueType
)
if
(
klass
.
UnderlyingSystemType
.
IsValueType
)
{
{
int
numLuaParams
=
LuaLib
.
LuaGetTop
(
luaState
);
int
numLuaParams
=
LuaLib
.
LuaGetTop
(
luaState
);
if
(
numLuaParams
==
0
)
if
(
numLuaParams
==
0
)
{
{
translator
.
Push
(
luaState
,
Activator
.
CreateInstance
(
klass
.
UnderlyingSystemType
));
translator
.
Push
(
luaState
,
Activator
.
CreateInstance
(
klass
.
UnderlyingSystemType
));
return
1
;
return
1
;
}
}
}
}
string
constructorName
=
(
constructors
.
Length
==
0
)
?
"unknown"
:
constructors
[
0
].
Name
;
string
constructorName
=
(
constructors
.
Length
==
0
)
?
"unknown"
:
constructors
[
0
].
Name
;
translator
.
ThrowError
(
luaState
,
String
.
Format
(
"{0} does not contain constructor({1}) argument match"
,
translator
.
ThrowError
(
luaState
,
String
.
Format
(
"{0} does not contain constructor({1}) argument match"
,
...
...
tests/LuaTests.cs
View file @
e198d37f
...
@@ -217,16 +217,16 @@ namespace NLuaTest
...
@@ -217,16 +217,16 @@ namespace NLuaTest
/*
/*
* Tests structure creation via the default constructor
* Tests structure creation via the default constructor
*/
*/
[
Test
]
[
Test
]
public
void
TestStructDefaultConstructor
()
public
void
TestStructDefaultConstructor
()
{
{
using
(
Lua
lua
=
new
Lua
())
using
(
Lua
lua
=
new
Lua
())
{
{
lua
.
DoString
(
"luanet.load_assembly('NLuaTest')"
);
lua
.
DoString
(
"luanet.load_assembly('NLuaTest')"
);
lua
.
DoString
(
"TestStruct=luanet.import_type('NLuaTest.Mock.TestStruct')"
);
lua
.
DoString
(
"TestStruct=luanet.import_type('NLuaTest.Mock.TestStruct')"
);
lua
.
DoString
(
"struct=TestStruct()"
);
lua
.
DoString
(
"struct=TestStruct()"
);
}
}
}
}
[
Test
]
[
Test
]
public
void
TestStructHashesEqual
()
public
void
TestStructHashesEqual
()
...
...
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