local childSize = imgui.ImVec2(-1, -1);
if (imgui.BeginChild('a', childSize, true)) then
local childStart = imgui.GetCursorPos();
-- тут вся твоя хуйня
if (childSize.x == -1) then
childSize = imgui.GetCursorPos() - childStart;
end
end
imgui.EndChild();