I new for lua programming. it is tcp client programming. when i run this program i have been getting this output. any one have idea.. i stuck with this code. any delay need getting proper output
channel number 51
channel number 52
channel number 53
channel number 54
channel number test 51
channel number test 53
channel number test 54
channel number test 52
-----------------------------------------------------------------------
num={51,52,53,54}
for _,v in ipairs(num)do
code=v
sendkey(code)
end
function sendkey(code)
print("channel number",code)
if (code == -1) then
return
end
local ip = "192.168.0.106" or ""
local splice = 12
local skyclient=C4:CreateTCPClient()
:OnConnect(function(client)
client:ReadAtLeast(1)
end)
:OnRead(function (client, data)
if (string.len(data) < 24) then
client:Write(string.sub(data, 0, splice))
client:ReadAtLeast(1)
splice = 1
else
print("channel number test",code)
client:Write(string.char(4,1,0,0,0,0,math.floor(224 + (code/16)), code % 16))
end
end)
:Connect(ip,5900)
end
The Section Title literally tells you that its about GMod Lua here. Not something else about tcp client programming.
GMod Lua Developer Discussion
To be fair I renamed it in response to this thread.
huh..but still the whle section is inside the Garrys Mod section, so..
Sorry, you need to Log In to post a reply to this thread.