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;
})