diff --git a/webbridge.lua b/webbridge.lua index 1ccb6c3..7069279 100644 --- a/webbridge.lua +++ b/webbridge.lua @@ -89,12 +89,18 @@ local function drawDashboard() monitor.setBackgroundColor(colors.black) monitor.clear() + -- Count turtles + local turtleCount = 0 + for _ in pairs(turtles) do + turtleCount = turtleCount + 1 + end + -- Simple header monitor.setBackgroundColor(colors.blue) monitor.setTextColor(colors.white) monitor.setCursorPos(1, 1) monitor.clearLine() - centerText(1, "TURTLE BRIDGE - " .. #turtles .. " TURTLES ONLINE", colors.white, colors.blue) + centerText(1, "TURTLE BRIDGE - " .. turtleCount .. " ONLINE", colors.white, colors.blue) -- Status line monitor.setBackgroundColor(colors.gray) @@ -108,7 +114,7 @@ local function drawDashboard() monitor.setBackgroundColor(colors.black) local startY = 4 - if #turtles == 0 then + if turtleCount == 0 then monitor.setTextColor(colors.gray) monitor.setCursorPos(2, startY) monitor.write("No turtles connected. Waiting for signals...")