【发布时间】:2016-10-11 18:00:29
【问题描述】:
我在 Lua 中每 10 秒通过 TCP 连接在两个 ESP8266 模块之间发送数据:
string="abc"
cl=net.createConnection(net.TCP, 0)
cl:connect(80,"192.168.4.1")
tmr.alarm(2, 10000, 1, function()
cl.send("The string variable is: "..string.."")end)
但是,如果我想像上面的代码一样发送字符串变量,我会不断收到错误消息:
PANIC: unprotected error in call to Lua API (init.lua:26: bad argument #1 to 'send' (net.socket expected, got string))
PANIC: unprotected error in call to Lua API (bad argument #1 (Server/Socket expected))
它仅在发送数值变量时对我有用。有没有办法发送字符串变量?
谢谢, 柿子
【问题讨论】: