Optimize lookups in ScriptEnvironment::addThing