#Not sure what you mean by a fallthrough

1 messages · Page 1 of 1 (latest)

silk garnet
#

For example, strictyaml is a python package that's used for the resolution of value types in a YAML file:

# this snippet doesn't actually succeed, but I think the point comes across
from strictyaml import Seq, Str, load
schema = Seq(Str()) | Str()
val = load("['this', 'is', 'a', 'list']", schema)
#

Of course, python is dynamically typed. C# has a var type, though I haven't looked into what it is or how it works yet.

karmic wind
#

Not sure if this is what you want but if you want to return 2 different type you can do like this

  • Create a class object
  • create a return function from that class object
  • then call it.
faint sequoia
#

var in c# is still very much strongly typed I believe as it's resolved at compile time.

silk garnet
#

Okay, I see - I'll just parse the strings at runtime, then

faint sequoia
#

Right, some types/data structs which you can't serialize I usually do it in Start() such as dictionaries.

silk garnet
#

not natively, at least 🙂 ^

faint sequoia
#

Yeah, there's implementations for it, but I prefer just making a struct of arrays and pairing them at runtime.

silk garnet
#

oh, interesting, interesting

silk garnet
#

@faint sequoia Do you know why Unity refuses to serialize dictionaries?