Saving / Loading from textfile

Basically I want to save variables over map change by using a textfile for each steamid. I’ve looked for awhile for a thread that had something like this and can’t find it. Sooo I was hoping you guys could help me out here.


[editline]15th February 2012[/editline]

Now how can I read data from a file? What I have now is:

function CreateFile( ply, filename )
local data = “Name-” … ply:Nick() … “/Points-100”
file.Write( filename, “” )
LoadPlayer( ply, filename )

function LoadPlayer( ply, filename )
local data = file.Read( filename )
local datatable = string.Explode( “/”, data )
local playername = string.Explode( “-”, datatable[1] )
print( "[DEBUG] Loading player " … playername[2] )
–[DEBUG] Loading player
–(The rest is blank)