Michael-48 / Iris

Iris is an Immediate mode GUI Library for Roblox, Based on Dear ImGui
https://michael-48.github.io/Iris/
MIT License
162 stars 26 forks source link

recursive tree doesn't work properly #53

Open shebov3 opened 3 months ago

shebov3 commented 3 months ago

not sure if this is actually made so you can make recursive trees but

here's a comparison between both iris and correct output structures image

here's the code

local controller = require(game.Players.LocalPlayer:WaitForChild("PlayerController"))
local replicatedStorage = game:GetService("ReplicatedStorage")

--[[ Modules ]]
local iris = require(replicatedStorage.Packages.iris)
iris.Init()

local function loop(i, table: table)
  iris.Tree({ `{i}` })
    for index, value in pairs(table) do
      if type(value) == "table" then
      loop(index, value)
      else
      iris.Text({ `{index} = {value}` })
      end
    end
  iris.End()
end 

iris:Connect(function()
  local windowSize = iris.State(Vector2.new(300, 200))
  iris.Window({ "Client" }, { size = windowSize })
  loop("PlayerController", controller)
  iris.End()
end)