Datastream Removed?

How are we going to transfer tables when datastream is removed in the next update?

Tons of Usermessages?

There’s a new net library to replace it.

(he later upped the limit from 4kb to 64kb :v:)

Thank Jesus, Thanks :v:

Maybe learn how to use usermessages properly, but ye, there is a new net library.

I know how to use usermessages but sending a big table is not a good idea.

If you need to send such a huge table that it will slow down the network, you’re doing something wrong.

Are you aware that datastream uses tons of usermessages already?

is glon encoding a table, sending it, and decoding it on the other side faster?


– Write a whole table to the stream
– This is less optimal than writing each
– item indivdually and in a specific order
– because it adds type information before each var

function net.WriteTable( tab )

for k, v in pairs( tab ) do

	net.WriteType( k )
	net.WriteType( v )


-- End of table
net.WriteByte( 0 )


function net.ReadTable()

local tab = {}

while true do

	local t = net.ReadByte()
	if ( t == 0 ) then return tab end
	local k = net.ReadType( t )

	local t = net.ReadByte()
	if ( t == 0 ) then return tab end
	local v = net.ReadType( t )
	tab[ k ] = v


net.WriteVars =
[TYPE_NUMBER] = function ( t, v ) net.WriteByte( t ) net.WriteLong( v ) end,
[TYPE_ENTITY] = function ( t, v ) net.WriteByte( t ) net.WriteEntity( v ) end,
[TYPE_VECTOR] = function ( t, v ) net.WriteByte( t ) net.WriteVector( v ) end,

function net.WriteType( v )

local typeid = TypeID( v )
local wv = net.WriteVars[ typeid ]
if ( wv ) then return wv( typeid, v ) end

Error( "Couldn't write type " .. typeid )


net.ReadVars =
[TYPE_NUMBER] = function () return net.ReadLong() end,
[TYPE_ENTITY] = function () return net.ReadEntity() end,
[TYPE_VECTOR] = function () return net.ReadVector() end,

function net.ReadType( typeid )

local rv = net.ReadVars[ typeid ]
if ( rv ) then return rv( v ) end

Error( "Couldn't read type " .. typeid )


Yes, I do.

(JVs is a crybaby :dance:, Kids Rating dumb - cant do anything else.)

Is this not what datastream does anyway? Encodes it with glon, splits the string up into as many usermessages as it needs, then sends them?