forked from your-land-mirror/minetest-flow
Fix gui.Nil example
This commit is contained in:
parent
9b53f1569d
commit
434c4f8fdf
@ -135,10 +135,13 @@ elements creates unnecessary containers.
|
|||||||
A tool to allow for ternary-ish conditional widgets:
|
A tool to allow for ternary-ish conditional widgets:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
gui.VBox{
|
local form = flow.make_gui(function(player, ctx)
|
||||||
gui.Label{ label = "The box below is only present if the boolean is truthy" },
|
local the_boolean = false
|
||||||
the_boolean and gui.Box{ color = "#FF0000" } or gui.Nil{},
|
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
|
Use sparingly, flow still has to process each `Nil` object to be able to know to
|
||||||
|
Loading…
Reference in New Issue
Block a user