OSL ‐ Enums - Mistium/Origin-OS GitHub Wiki

This is how you use an enum

an enum is literally exactly the same as an array, its stored the exact same. The first two examples are just different ways of writing the exact same thing

enum states [
  "mainmenu",
  "crafting"
]

equivalent with array

states = [
  "mainmenu",
  "crafting"
]

equivalent with object

states = {
  "mainmenu":"1",
  "crafting":"2"
}

The code that comes after it is the same for all setup implementations

state = states.mainmenu
mainloop:
  if state == states.mainmenu (
    //main menu code
  )
  if state == states.crafting (
    //crafting code
  )
  import "win-buttons"