build Toml Table
inline fun buildTomlTable(initialCapacity: Int = 8, block: TomlTableBuilder.() -> Unit): TomlTable(source)
Creates a TomlTable by populating a TomlTableBuilder with block.
val table = buildTomlTable {
array("array-of-table") {
table(TomlComment("Empty.")) { }
table(TomlComment("This is a comment for a single table.")) {
literal("multiline", "Multiline\nString", TomlMultilineString.Instance)
}
}
table("\n", TomlComment("Normie table.")) {
literal("color", 0xFF_E4_90, TomlInteger(TomlInteger.Base.Hex, group = 2))
}
element("null", TomlNull, TomlComment("Null,\nas always."))
literal("float", Double.NEGATIVE_INFINITY)
}Content copied to clipboard
will produce:
# Null,
# as always.
null = null
float = -inf
# Normie table.
["\n"]
color = 0xFF_E4_90
# Empty.
[[array-of-table]]
# This is a comment for a single table.
[[array-of-table]]
multiline = """
Multiline
String"""Content copied to clipboard