nsensfel / tonkadur

Narrative scripting/programming tool. Write stories in your favorite editor using a feature-rich language, compile them into a very small and simple language to easily integrate them into your game.
https://tonkadur.of.tacticians.online
Apache License 2.0
2 stars 0 forks source link

Add union type support #45

Open nsensfel opened 4 months ago

nsensfel commented 4 months ago
(declare_union #item
   (weapon #weapon)
   (armor #armor)
   (consumable #consumable)
   nothing
)
   (lambda ((#item i))
      (switch i
         ((weapon w) (eval is_sword w))
         ((armor a) (false))
         ((consumable a) (false))
         (nothing (false))
      )
   )