Lua core improvements

The goal here is to make FF's Lua environment more robust while maintaining backwards compatibility.