Improve output formatting

This commit is contained in:
Filip Tibell 2023-01-20 22:21:31 -05:00
parent 89d0606d06
commit 25b1dcb472
No known key found for this signature in database
2 changed files with 15 additions and 0 deletions

View file

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Improved output formatting of non-primitive types
- Improved output formatting of empty tables
## `0.0.4` - January 21st, 2023 ## `0.0.4` - January 21st, 2023
### Added ### Added

View file

@ -154,6 +154,14 @@ pub fn pretty_format_value(buffer: &mut String, value: &Value, depth: usize) ->
} }
} }
} }
Value::Vector(x, y, z) => {
write!(buffer, "{COLOR_PURPLE}<vector({x}, {y}, {z})>{COLOR_RESET}",)?
}
Value::Thread(_) => write!(buffer, "{COLOR_PURPLE}<thread>{COLOR_RESET}")?,
Value::Function(_) => write!(buffer, "{COLOR_PURPLE}<function>{COLOR_RESET}")?,
Value::UserData(_) | Value::LightUserData(_) => {
write!(buffer, "{COLOR_PURPLE}<userdata>{COLOR_RESET}")?
}
_ => write!(buffer, "?")?, _ => write!(buffer, "?")?,
} }
Ok(()) Ok(())