SplitScript reference / Language / maxLength
maxLength
syntax
String field maxLength maxUtf16Units;
Bounds a managed string field read.
A managed String or optional T? field must declare maxLength so malformed or version-mismatched process memory cannot cause an unbounded allocation. The value is a positive compile-time count of UTF-16 code units. The field still has the ordinary String type. A non-optional null reference rejects the read; String? maps a null reference to None. Process-read failures and payloads longer than the bound remain errors rather than becoming None or silently truncated text. Invalid UTF-16 is decoded with replacement characters. The same policy applies to static fields, live instance paths, and class snapshots.
Examples
Declare required and optional managed strings
String name maxLength 64;
String? subtitle from "currentSubtitle" maxLength 256;