【发布时间】:2014-10-03 09:38:56
【问题描述】:
我想让下面的测试函数打印出消息“k is not nil”,但我的代码不起作用。它已经从我的服务器接收到 k 值,但是如果 k~=nil 则它不会检查该行。下面是我的代码。感谢您的任何建议。
local function receiveData( )
local l,e = client:receive()
if l~=nil then
print(l)
return l,e
else
timer.performWithDelay(100,receiveData)
end
end
function test( )
k = receiveData()
if k ~=nil then
print("k isn't nil")
end
end
test()
【问题讨论】:
-
如果您认为应该改进答案以获得投票,我们将不胜感激,谢谢!