Geting variables from textfile

I got a text file looking like this

my name  
my home town  
my shoe size  
my age  
my height  

When i have read this information in how do format it so that row 1 gets to me var MyName and so forth? [import]uid: 28895 topic_id: 6665 reply_id: 306665[/import]

I found this function

  
function explode(div,str)  
  
 if (div=='') then return false end  
 local pos,arr = 0,{}  
 -- for each divider found  
  
 for st,sp in function() return string.find(str,div,pos,true) end do  
 -- Attach chars left of current divider  
 table.insert(arr,string.sub(str,pos,st-1))   
 pos = sp + 1 -- Jump past current divider  
 end  
  
 -- Attach chars right of last divider  
 table.insert(arr,string.sub(str,pos))   
 return arr  
end  
  

and now my textfile looks like this: my name my home townXZXmy shoe sizeXZXmy ageXZXmy height

Making me get this array whit my variables.

 local varArray = explode("XZX", contents)  

Is thee a better way? [import]uid: 28895 topic_id: 6665 reply_id: 23619[/import]