Latest changes from 'studio' branch

I've only built this for vs2008, Lua 5.1 Debug. Maybe some fixes needed for the other platforms.

After this has been merged and built we should drop the studio branch and never speak of it again.  :]