Improved lua_to_value, better errors