samedi 26 décembre 2015

How do I perform a bitwise OR on .NET enums in script running with NLua?

I have the following reflection code in C# which I'm trying to replicate using NLua script: G.Object.GetType().GetField("count", BindingFlags.Instance | BindingFlags.NonPublic);

Everything is fine, until I try to use Bitwise OR operation on two flags. I have alerady tried:
BindingFlags.Instance + BindingFlags.NonPublic (arithmetic operation on non-number) BindingFlags.Instance | BindingFLags.NonPublic (not working, obviously, but worth a try)

I have also tried pure Lua implementations of bit-manipulation libraries. All fail, because what I'm trying to OR is called 'userdata' type in NLua.

Conversion of 'userdata' type using tonumber() also fails.

My current Lua code is below:
obj = G.Object:GetType() field = obj:GetField("count", *...two OR'd flags here...*)





Aucun commentaire:

Enregistrer un commentaire