snet = require("snet")
bstream = snet.bstream
--
for I = 2,3 do
bstream['vector'..I..'d'] = function(bs,x,y,z)
local readResult = {}
if x ~= nil and y ~= nil and (I == 3 and z ~= nil or true) then--write
-- local bs = bstream.new()
for k,v in pairs({x,y,z}) do
bs:write(BS_FLOAT,v)
end
return bs
end
for i = 1,I do--read
readResult[i] = bs:read(BS_FLOAT)
end
return (I == 3 and {x=readResult[1],y=readResult[2],z=readResult[3]} or {x=readResult[1],y=readResult[2]})
end
end