Import std.core.load
RenameAll
attribute
Public Attribute RenameAll(Style: String)
A Struct or Class each of whose Fields has its name in a case as its key, as though each had
that @Rename: "snake_case", "SCREAMING_SNAKE_CASE", "kebab-case", "SCREAMING-KEBAB-CASE",
"camelCase", "PascalCase", "lowercase", or "UPPERCASE". A Field's own @Rename wins. A name's
words are what _s part, and what starts at a capital after a small letter or a digit, or at
the last capital of a run before a small letter, so HTTPPort is http_port.
Examples
@RenameAll("snake_case")
Struct Player
Field PlayerName: String
Field MaxHealth: Int
@Rename("lvl") Field Level: Int
End Struct
Local saved = Save(Player("Ada", 100, 3))
Expect(saved.Keys() == ["player_name", "max_health", "lvl"])
Local loaded = Try Load<Player>(saved)
Expect(loaded.PlayerName == "Ada" && loaded.MaxHealth == 100)Report an issue with this page or with FutureBlitz on GitHub.