As Sebastian says, you need to declare it as local inside of a function if you want it to only be accessible from inside of the function & sorry, I didn't realize what you was talking about. I was referring to these myself...
function name(var1, var2)
var1 = Objects[var1]
var2 = Scenes[var2]
end
name("rock", "beach")
The input variables of your function become local automatically. Manually declared variables will either need to be set local by you or left as global.