Adjusted the lua's map API, requiring a large rewrite

One the whole nothing major has changed, but I think this makes things
more logical. I just hope its stable, since I'm releasing a new tag.