Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to avoid dotted subtables entirely? #809

Open
fosskers opened this issue Nov 12, 2024 · 2 comments
Open

How to avoid dotted subtables entirely? #809

fosskers opened this issue Nov 12, 2024 · 2 comments

Comments

@fosskers
Copy link

Hi there. Currently naive calls to to_string_pretty yield output like:

[[foo]]
a = "a"

[foo.bar]
b = "b"

but I'd like it to output:

[[foo]]
a = "a"
bar = { b = "b" }

How can I accomplish this? I spent some time experimenting with DocumentMut but was unsuccessful. set_dotted seems like it might be what I want, but in practice it didn't appear to be. Am I overlooking something obvious?

Thank you.

@epage
Copy link
Member

epage commented Nov 12, 2024

to_string_pretty errs on the side of making Tables when what you want is an InlineTable which is the default in some circumstances. To say much more, I'd need more context.

@fosskers
Copy link
Author

I see that Table and InlineTable can be freely converted into one another. I'll try that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants