Added monitor usage to getting-started

This commit is contained in:
Robert Jelic
2025-04-21 08:30:49 +02:00
parent c05248a601
commit 2f750e2836

View File

@@ -76,6 +76,30 @@ element:onChange(function(self, value)
end)
```
## Using monitors instead
Basalt can render to monitors instead of the terminal. Here's how to use monitors:
```lua
local basalt = require("basalt")
-- Get a reference to the monitor
local monitor = peripheral.find("monitor")
-- Or specific side: peripheral.wrap("right")
-- Create frame for monitor
local monitorFrame = basalt.createFrame():setTerm(monitor) -- :setTerm is the important method here
-- Add elements like normal
monitorFrame:addButton()
:setText("Monitor Button")
:setWidth(24)
:setPosition(2, 2)
-- Start Basalt
basalt.run()
```
## Next Steps
- Check out the [Examples](https://github.com/Pyroxenium/Basalt2/tree/main/examples) for more complex UIs