Fix gui.Nil example

This commit is contained in:
luk3yx 2025-02-27 17:45:36 +13:00
parent 9b53f1569d
commit 434c4f8fdf

View File

@ -135,10 +135,13 @@ elements creates unnecessary containers.
A tool to allow for ternary-ish conditional widgets:
```lua
gui.VBox{
gui.Label{ label = "The box below is only present if the boolean is truthy" },
the_boolean and gui.Box{ color = "#FF0000" } or gui.Nil{},
}
local form = flow.make_gui(function(player, ctx)
local the_boolean = false
return gui.VBox{
gui.Label{label = "The box below is only present if the boolean is truthy"},
the_boolean and gui.Box{w = 1, h = 1, color = "#FF0000"} or gui.Nil{},
}
end)
```
Use sparingly, flow still has to process each `Nil` object to be able to know to