Commit db21506a authored by Kagamia's avatar Kagamia Committed by Vinicius Jarina
Browse files

Fix passing bytearray from lua.

parent 4a6440e9
......@@ -167,12 +167,10 @@ namespace NLua
else
return null;
}
else
{
object obj = _translator.GetNetObject(luaState, stackPos);
if (obj != null && paramType.IsInstanceOfType(obj))
return _extractNetObject;
}
object netObj = _translator.GetNetObject(luaState, stackPos);
if (netObj != null && paramType.IsInstanceOfType(netObj))
return _extractNetObject;
return null;
}
......
......@@ -2776,6 +2776,29 @@ namespace NLuaTest
WriteBinary (value);
");
}
}
[Test]
public void RawByteArrayParameter()
{
using (var lua = new Lua())
{
lua.LoadCLRPackage();
lua["WriteBinary"] = (Action<byte[]>)WriteBinary;
lua.DoString(@"
import 'System'
local value = Byte[8]
value[0] = 1
value[1] = 2
value[2] = 3
value[3] = 0x3f
value[4] = 0x40
value[5] = 0xff
value[6] = 0xf3
value[7] = 0x9f
WriteBinary (value);
");
}
}
Entity myEntity;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment