MoonVeil-Docs/content/docs/options/flatten-control-flow.md

1.1 KiB

weight title description icon date lastmod
100 Flatten control flow Control flow flattener article 2025-05-01T18:47:58-05:00 2025-05-01T18:47:58-05:00

This option will enable the Control Flow Flattener (CFF). This feature is conservative in it's estimates of what can be flattened, if a block can't be flattened without side effects, it will be discarded from the flattening queue. CFF is applied recursively to failed blocks, meaning if a block is discarded from the flattening queue, its children may be flattened individually.

The control flow flattener supports the following branching syntaxes:

  • if statements
  • while and repeat loops
  • numeric for loops
  • break and continue statements
  • for-in loops and even support for Luau's generalized iteration

The following child options are available:

  • Wrap CFF blocks: This will move some CFF blocks into their own closure in a lookup table.
  • Hoist locals: Will move local storage into a lookup table for CFF blocks. Useful to cut down on the number of used locals.