added checks for use of undeclared global Lua variables.