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
d7f1849b
Commit
d7f1849b
authored
Oct 24, 2014
by
Vinicius Jarina
Browse files
Fixed #116 problem accessing base class method
+ regression test.
parent
f70558bd
Changes
2
Show whitespace changes
Inline
Side-by-side
Core/NLua/Metatables.cs
View file @
d7f1849b
...
...
@@ -684,6 +684,14 @@ namespace NLua
LuaLib
.
LuaPushNil
(
luaState
);
}
}
else
{
if
(
objType
.
UnderlyingSystemType
!=
typeof
(
object
))
{
#
if
NETFX_CORE
return
GetMember
(
luaState
,
new
ProxyType
(
objType
.
UnderlyingSystemType
.
GetTypeInfo
().
BaseType
),
obj
,
methodName
,
bindingType
);
#
else
return
GetMember
(
luaState
,
new
ProxyType
(
objType
.
UnderlyingSystemType
.
BaseType
),
obj
,
methodName
,
bindingType
);
#
endif
}
// kevinh - we want to throw an exception because meerly returning 'nil' in this case
// is not sufficient. valid data members may return nil and therefore there must be some
// way to know the member just doesn't exist.
...
...
tests/LuaTests.cs
View file @
d7f1849b
...
...
@@ -21,6 +21,29 @@ using NUnit.Framework;
namespace
NLuaTest
{
#
if
MONOTOUCH
[
Preserve
(
AllMembers
=
true
)]
#
endif
public
class
master
{
public
static
string
read
()
{
return
"test-master"
;
}
}
#
if
MONOTOUCH
[
Preserve
(
AllMembers
=
true
)]
#
endif
public
class
testClass
:
master
{
public
String
strData
;
public
int
intData
;
public
static
string
read2
()
{
return
"test"
;
}
}
#
if
MONOTOUCH
[
Preserve
(
AllMembers
=
true
)]
...
...
@@ -34,6 +57,8 @@ namespace NLuaTest
}
}
#if MONOTOUCH
[
Preserve
(
AllMembers
=
true
)]
#endif
...
...
@@ -2202,6 +2227,18 @@ namespace NLuaTest
Assert
.
True
(!
string
.
IsNullOrEmpty
(
x
));
}
[
Test
]
public
void
TestCallImplicitBaseMethod
()
{
using
(
var
l
=
new
Lua
())
{
l
.
LoadCLRPackage
();
l
.
DoString
(
"import ('NLuaTest')"
);
l
.
DoString
(
"res = testClass.read() "
);
string
res
=
(
string
)
l
[
"res"
];
Assert
.
AreEqual
(
testClass
.
read
(),
res
);
}
}
static
Lua
m_lua
;
}
...
...
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