Add Lua function comm.socketServerSendBytes (resolves #2194)
takes a single param of an array-like table, casts each element to byte before passing to ApiHawk
This commit is contained in:
parent
45488f2667
commit
fafa29a2bf
|
@ -1,8 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using NLua;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
[Description("A library for communicating with other programs")]
|
||||
|
@ -54,6 +57,13 @@ namespace BizHawk.Client.Common
|
|||
return APIs.Comm.Sockets.SendString(SendString);
|
||||
}
|
||||
|
||||
[LuaMethod("socketServerSendBytes", "sends a string to the Socket server")]
|
||||
public int SocketServerSendBytes(LuaTable byteArray)
|
||||
{
|
||||
if (!CheckSocketServer()) return -1;
|
||||
return APIs.Comm.Sockets.SendBytes(_th.EnumerateValues<double>(byteArray).Select(d => (byte) d).ToArray());
|
||||
}
|
||||
|
||||
[LuaMethod("socketServerResponse", "receives a message from the Socket server")]
|
||||
public string SocketServerResponse()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue