Variables

Posted by Fadedparadox on Sat 02 Dec 2006 08:40 AM — 1 posts, 9,873 views.

USA #0
I found a longer version of this, and I edited it to suit what I needed. I tested as best I could, but I figured I would ask to make sure. Are there any errors in this, assuming I will only use it with numbers and only to check or change them?


var = {}
setmetatable (var, 
 { 
 __index = 
 function (t, name) 
  return tonumber(GetVariable (name)) 
 end;
 __newindex = 
 function (t, name, val) 
  local result
  result = SetVariable (name, val) 
 end;
 })