Code: Select all
-- client packs and sends data to the server
datatable = { player.x,player.y };
data = lube.bin:pack( datatable );
lube.client:send( data );
Code: Select all
-- server gets data and unpacks it to a string
function recv(data, ip)
datatable = lube.bin:unpack( data );
str = ip .. " x: " .. tostring( datatable[1] ) .. " y: " .. tostring( datatable[2] );
end
Code: Select all
127.0.0.1 x: nil y: nil