Optionals
Optionals represent a value which could be nil
, and can be applied to any datatype. Optionals are most often used from
within a struct
, where you might not want or need all fields to exist in the data you're
sending.
function light.datatypes.optional
Example
Let's say you want to represent some settings that have a value or be unset. A really simple and efficient way to encode that data is with a struct of optionals.