Switching from Datastream to the Net [GM13]

I’m sure to get a lot of boxes for this, but can someone help me switch from the datastream module to the net library? I’m using Evolve and Pointshop which both use datastream… I’d like to know how to make it compatible with GM13 manually.

Here’s the lines of code that datastream are used with:
[lua]datastream.StreamToClients( player.GetAll(), “EV_PluginFile”, { Title = title, Contents = file.Read( “…/lua/ev_plugins/” … plugin ) } )[/lua]
[lua]datastream.Hook( “EV_PluginFile”, function( handler, id, encoded, decoded )[/lua]
[lua]datastream.Hook(“PointShop_Items”, function(handler, id, encoded, decoded)[/lua]
[lua]datastream.StreamToClients(self, “PointShop_Items”, self.Items)[/lua]

I tried to look at this thread http://www.facepunch.com/threads/1142347 but frankly I’m confused as all hell… :confused: crosses finger for a kind soul to take some time and help me out

http://wiki.garrysmod.com/page/Lua/Tutorials/Using_the_net_library should be helpful, but for the specific examples you listed…

-- Put this somewhere that'll occur once serverside.

-- Serverside in place of StreamToClients:

-- Clientside in place of datastream.Hook:
net.Receive("EV_PluginFile", function(len)
       local title = net.ReadString()
       local contents = net.ReadString()
       // Replace any references to 'decoded["Title"]' with 'title' and 'decoded["Contents"]' to 'contents'

And for PointShop, similar:

-- Put this somewhere that'll occur once serverside.

-- Serverside in place of StreamToClients:
net.Send(self) -- 'self' is an odd name for a variable containing a player...

-- Clientside in place of datastream.Hook:
net.Receive("PointShop_Items", function(len)
       local decoded = net.ReadTable()
       //No replacement neccesary

Thanks, I’m sure this well help out lots of other people other than just me.

[editline]19th October 2012[/editline]

Might as well use this thread to ask another question about switching stuff to GM13 instead of making another…

What does this error mean:
[ERROR] )’

  1. unknown - addons/evolve/lua/ev_plugins/sv_restriction.lua:0

This happens with another file like tab_ranks.lua

Code to the sv_restriction file if you need: http://pastebin.com/bpwN6JKJ

Had to try lua_openscripting that with a placeholder local evolve table to find find it, but the problem is in string.find’s use of ‘.’ on line 87. I believe normal characters no longer need to be escaped in regex patterns? Something like that, its a very recent change so theres no information on it yet.

You’ll also need to update line 88 since FindInLua no longer exists, I believe to ‘file.Find( “weapons/gmod_tool/stools/*.lua”, “LUA” )’

Yep, that fixed it, thanks again.

[editline]19th October 2012[/editline]

So the last 2 things I’m getting is because of

A) Something called filex was apparently removed… attempt to index global ‘filex’ (a nil value)
[lua]filex.Append( logFile, “[” … os.date() … "] " … str … "
" )[/lua]
B) The above is causing TTT to not load ( I think ) and other errors come from that

filex previously only contained the Append function, Garry moved it into file, so just remove the x.