Open fhoenig opened 1 year ago
Is there a suggested way to make chains of properties "safe" in a reasonably low overheard way?
example: local a = thing.transform.position.x where thing, transform and position is a user type, but each of them can be optional.
local a = thing.transform.position.x
thing
transform
position
let's say transform does not exist on thing as determined on the C++ side.
You can use something like that:
local thing = { transform = { position = { --x = 1 } } } local foo = (((thing or {}).transform or {}).position or {}).x print(foo)
Is there a suggested way to make chains of properties "safe" in a reasonably low overheard way?
example:
local a = thing.transform.position.x
wherething
,transform
andposition
is a user type, but each of them can be optional.let's say
transform
does not exist onthing
as determined on the C++ side.