dynamic sql row.name

I want to pass a value to > row.name with function param

function getData(dataname)  
 local sql = "SELECT ........."  
 for row in db:nrows(sql) do  
 local text = row.dataname -- \< dynamic row.name with function param  
 return text  
 end  
end  
  
usage:  
local value = getData('username')  
  
want to:  
row.username  
  

row.dataname = nil
I try: row…dataname or row…dataname and got errors [import]uid: 51730 topic_id: 16953 reply_id: 316953[/import]

row[dataname]  

is the solution [import]uid: 51730 topic_id: 16953 reply_id: 63560[/import]