Passing ByteArray from C# function to Lua code

235 views
Skip to first unread message

Balaji D

unread,
Jul 30, 2015, 2:03:02 PM7/30/15
to Lua BR

I work on a C# based GUI interfacing with a Lua engine. I searched for help but I am not getting a correct solution and I cannot change much on the Lua side because the LuaInterface.dll is given to me and cannot be changed.

In C#, I have a function as below:

public Int32 Calculate_Func(string input,out Byte[] byte_arr)
{
  byte_arr = Process(input);
  return 1;
}

In Lua, I call the above function as:

ret, val = Calculate_Func(Packet_String)

But I see that the byte array is not getting reflected in my Lua function. When I try reading the value of the val variable, it returns System.Byte[]. I am unable to access the byte array values in Lua.

But If I change the byte array to string, the value gets returned, but I need the bytes to be processed in Lua. How can I achieve this?

Luiz Henrique de Figueiredo

unread,
Jul 30, 2015, 2:09:03 PM7/30/15
to lua...@googlegroups.com
For discussions in English, try posting to lua-l:
http://www.lua.org/lua-l.html
Reply all
Reply to author
Forward
0 new messages