Closed d-led closed 10 years ago
This issue is a bit complicated, but the main problem is not in DynamicLua but in NLua:
In this line of NLua BindingFlags.IgnoreCase
it set. (According to the comment they had even BindingFlag.Private
in there, but removed it). Since your private member is called name
and your public property is called Name
that one is found, since they search case-invariant.
So a simple workaround is to rename the property. Interestingly then your code returns name
, instead of throwing an exception, which is a bit strange. (BTW: You don't need that [0]
, an DynamicArray
containing exactly one element can be implicitly converting to it's containing value.)
Please note that the code throws the correct exception, when the access goes through DynamicLua, which is even a bit simpler that to return the value from Lua.
string answer = lua.obj.name
So this basically a bad design decision in NLua... I'll close this issue as wont-fix, feel free to report it to NLua!
I just reported this issue to NLua: https://github.com/NLua/NLua/issues/98
ok!
They fixed it, so you could try using DynamicLua with a new version of the NLua.dll. Probably I will also push fixed version soon (or solve the dependency problem some other way, especially for Mono...)
great!
As it seems, privates can be read from. The assertion fails:
with