mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 04:50:36 +00:00
Fix Stack Overflow while Formatting Tables with Circular Keys (#183)
This commit is contained in:
parent
34fc23d024
commit
fe55442dac
1 changed files with 7 additions and 2 deletions
|
@ -130,7 +130,7 @@ pub fn pretty_format_value(
|
|||
} else if let Some(s) = call_table_tostring_metamethod(tab) {
|
||||
write!(buffer, "{s}")?;
|
||||
} else if depth >= 1 && parent_table_addr.eq(&table_addr) {
|
||||
write!(buffer, "{}", STYLE_DIM.apply_to("<self>"))?
|
||||
write!(buffer, "{}", STYLE_DIM.apply_to("<self>"))?;
|
||||
} else {
|
||||
let mut is_empty = false;
|
||||
let depth_indent = INDENT.repeat(depth);
|
||||
|
@ -148,7 +148,12 @@ pub fn pretty_format_value(
|
|||
)?,
|
||||
_ => {
|
||||
write!(buffer, "\n{depth_indent}{INDENT}[")?;
|
||||
pretty_format_value(buffer, &key, parent_table_addr.clone(), depth)?;
|
||||
pretty_format_value(
|
||||
buffer,
|
||||
&key,
|
||||
parent_table_addr.clone(),
|
||||
depth + 1,
|
||||
)?;
|
||||
write!(buffer, "] {} ", STYLE_DIM.apply_to("="))?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue