Help with setting a variable inside a net.Receive()

So I’m working on a ‘database’ system; it basically just writes / reads from text files in the /data/ directory.
However; I’m having some issues, I’ve got to the point where I can read a file from the server and send it to the client, they can then read it using a net.Receive()… but… when I try to set a variable inside it for use with VGUI; it doesn’t work.

I’m making a DListView and I want to add the string I get back from the server to the AddLine().

E.g.


player_list_:AddLine(tostring(_ply_name), tostring(_ply_crimes), tostring(_ply_lkl), tostring(_ply_notes), tostring(_ply_cash))

so I get the data clientside with this:


net.Receive( "em_return_data", function()
local contentsa = net.ReadString()
end )


but I want to convert the string it reads to …


_ply_name

… so I can add it to the DListView; I’ve tried directly setting the variable; making a second global variable and setting that; making a table and inserting values into that…

I’m not really sure where to go from now, if there is an easier way to do a file.read() serverside and send the data clientside please let me know :smiley:

Thanks!


Edit:

Also tried using SetGlobalString and GetGlobalString; did not work once.

Second Edit:

I was just being an idiot; SetGlobalString DID work; but it requires opening the GUI once to get the variable and then opening it a second time to use it;
still looking for a better way to do a file.read serverside and send the contents clientside if possible :smiley:

[editline]12th September 2015[/editline]

May have just figured it out; will post a reply soon.


FIXED

Today just isn’t a very good coding day for me… I just make some net messages to read serverside, set the variable, then read it clientside, it works fine.