Fix declaring global variables from a map script. Fix #507.

Map scripts have a special environment with an __index function that allows to
get map entities easily. But when you set an environment, you no longer
have the usual __newindex that defines a global value.