Datastream 2.0

Datastream 1.0 was an abomination; however, it did solve the issue of the size and data limitations of usermessages in a convenient manner.
Due to this, many developers used Datastream in their gamemodes, addons, and miscellaneous scripts.

If you run a server, it is highly likely you are worrying whether your gamemodes, addons and miscellaneous scripts will work when GMod 13 is released.
Worry no more!
Being the primary developer of Datastream (Janorkie/LuaBanana did nothing but rewrite it 20 times and then release it), I feel responsible for ensuring there is as little impact as possible when it is removed.
Hence, here is Datastream 2.0 to temporarily solve the issues by providing backwards compatibility for code that relies on Datastream.

If you are a server owner:
When GMod 13 is released, install Datastream 2.0, copy the Datastream 2.0 code into Notepad and save it as:



(current beta:)
garry's mod beta/garrysmod/lua/includes/modules/datastream.lua
(when released:)
garrysmod/garrysmod/lua/includes/modules/datastream.lua


Then copy the following code into (a new blank) Notepad:



require"datastream"


And save it as:



(current beta:)
garry's mod beta/garrysmod/lua/autorun/datastream.lua
(when released:)
garrysmod/garrysmod/lua/autorun/datastream.lua


Datastream 2.0 is inefficient compared to proper usage of the new net library (in ANY situation).
You should attempt to find a coder to remove your code’s dependency on Datastream.

If you are a developer:
DO NOT USE THIS MODULE.

All new code should be using the new net library.
Datastream 2.0 is designed as solution for server owners who have existing systems.

If you are Garry:
I don’t recommend including this in the new version - as I’m sure you agree.

Note:
This module will not work properly until Garry finishes net.*Table.
I have performed little testing of this module; don’t be surprised if it doesn’t work.
Not all uses of Datastream are accounted for; don’t be surprised if it doesn’t work.
Streams larger than 64KB are not supported (if you are sending this much: you are doing it wrong).
GLON is not required unless your code uses the “encdata” argument (why the hell did Janorkie put that there?).

If all fails, copy Datastream 1.0 from a previous version of GMod and use it; it should still work.

net.*Table was fixed, you can put any datatype in it now.

I’m glad you don’t recommend this. It’s a good initiative to get projects to work that the developer abandoned.

-i should read-

nice

Did you actually read a


single

line from the OP? Geez…

GJ reading the post.
Not every server owner has your spectacular L.U.A. prowess and may not in fact be able to update their shit.
This allows them to continue to have a server while waiting for someone to turn up who can.

This new datastream uses the net library, it also ensures backwards compatibility for older addons that used datastream.

This is useful for non-developers who want to use old addons but don’t know how to code to update the addons.

[editline]:([/editline]
damnit lexic

Sorry about that. I read little bits and skipped the net part.

I don’t see the point in even releasing a Datastream 2.0.

Being a person who used datastream in previous projects, i found it a lot easier to just rewrite the code that used datastream (if you’re doing it right, then the amount of times you’ve used datastream can be counted on one hand).

People would be better off simply optimizing their old code instead of using backwards compatibility crutches.

So change them then? It literally doesn’t take long at all seeing as the new net library functions almost on the same level as datastream.

And like i said, if you’re doing it properly then you’ll only have a few situations where you actually use datastream anyhow. It took me all of 30 minutes to convert all my old scripts to use the net library, and it also gave me an opportunity to optimize them in the process.

Server owners =/= lua coders.

Hmm yes, instead of getting dumbass server owners to update their scripts let’s toss them an inefficient lazy workaround.

Sadly.

What part are you not understanding? They can’t update their scripts because they don’t know how.

Well their script came from somewhere didn’t it? Whoever wrote it can surely fix it.

Instead of enabling bad server hosts we could instead just force them to fix their problems the right way.

And maybe those scripters aren’t active anymore, or maybe they are too busy with another project.

Or maybe server owners just want their shit to work until the scripters have updated their scripts.

No more CRecipientFilters in the new net library?