An enum represents a set of possible values. Because of limitations with string types, to get full type info from some
enums you will need to typecast into a
string singleton type.
Passing the first parameter to light.enum() represents a tagged enum type. Tagged enums are a set of structs, and the first parameter is the name for an identifier field. Here's an example mouse_event:
localty=light.datatypeslocalmouse_event=ty.enum("type"::"type",{move={delta=ty.vect2(),position=ty.vect2()},drag={delta=ty.vect2(),position=ty.vect2()},click={click_button=ty.enum({-- using an identifier enum for the button"Left"::"Left","Right"::"Right","Middle"::"Middle",}),position=ty.vect2()}})--(1)!
localty=light.datatypes-- Q: why would you want to network an AST?-- A: fuck if i knowlocalastlocalnode=ty.computed(function()returnastend)ast=light.enum("kind"::"kind",{number_expr={value=ty.f64,},add={left=node,right=node,},subtract={left=node,right=node,},})--(1)!