跳到主要内容

SFBLua接口说明

SFBLua接口说明

SFB实现的Lua自定义接口说明:

  1. void print(string content)

功能:打印输出

参数:content,字符串,即要输出的字符内容;

返回:无

  1. void timedelay(int ms)

功能:延时等待

参数:ms,整数,时间长度,单位毫秒;

返回:无

  1. bool readbool(int index)

功能:读开关量

参数:index,整数,索引值,不应该大于开关量的最大值8191;

返回:开关量的值;

  1. bool writebool(int index, bool value)

功能:写开关量

参数:index,整数,索引值,不应该大于开关量的最大值8191;

value, 布尔,待写入的值;

返回:写入的值

  1. int readint(int index)

功能:读数字量

参数:index,整数,索引值,不应该大于数字量的最大值8191;

返回:数字量的值;

  1. int writeint(int index, int value)

功能:写数字量

参数:index,整数,索引值,不应该大于数字量的最大值8191;

value, 整数,待写入的值;

返回:写入的值

  1. float readfloat(int index)

功能:读浮点量

参数:index,整数,索引值,不应该大于浮点量的最大值8191;

返回:浮点量的值;

  1. float writefloat(int index, float value)

功能:写浮点量

参数:index,整数,索引值,不应该大于浮点量的最大值8191;

value, 浮点数,待写入的值;

返回:写入的值

  1. TcpListener listenPortInit(int port, bool stopSame)

功能:TCP端口监听初始化

参数:port,整数,端口号,端口号不允许重复以及与系统端口冲突,否则会异常;

stopSame, 布尔,是否先停止与输入端口相同的监听再创建新的端口监听;

返回:已经创建的端口监听对象;

  1. void listenPortStart(TcpListener lis)

功能:启动TCP端口监听

参数:lis,TCP端口监听对象;

返回:无

  1. TcpClient listenConnect(TcpListener lis)

功能:侦听客户端连接,此接口会等待直到有客户端连接才返回;

参数:lis,TCP端口监听对象;

返回:连接到此监听的TCP端口的客户端;

  1. void listenPortStop(TcpListener lis)

功能:停止TCP端口监听

参数:lis,TCP端口监听对象;

返回:无