Как парсить данные в imgui combo

l1ght777

Активный
Автор темы
345
53
Версия MoonLoader
Другое
Киньте пример кода, как можно парсить данные с таблицы в imgui combo
 

bfix

Активный
108
81
Возможно то что ты просишь , а так вот все гайды практически нужные - https://www.blast.hk/threads/170647/
lua:
local comboInt = imgui.new.int(0)
local comboTbl = {'test', 'test1', 'test2'}
local ImItems = imgui.new['const char*'][#comboTbl](comboTbl)
local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    function(player)
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 300, 300
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        if imgui.Begin('Main Window', renderWindow) then
            if imgui.Combo(u8'Список', comboInt, ImItems, #comboTbl) then
                print(comboInt[0]) -- output: 0 1 2
            end
            imgui.End()
        end
    end
)
 

l1ght777

Активный
Автор темы
345
53
Возможно то что ты просишь , а так вот все гайды практически нужные - https://www.blast.hk/threads/170647/
lua:
local comboInt = imgui.new.int(0)
local comboTbl = {'test', 'test1', 'test2'}
local ImItems = imgui.new['const char*'][#comboTbl](comboTbl)
local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    function(player)
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 300, 300
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        if imgui.Begin('Main Window', renderWindow) then
            if imgui.Combo(u8'Список', comboInt, ImItems, #comboTbl) then
                print(comboInt[0]) -- output: 0 1 2
            end
            imgui.End()
        end
    end
)
А через for ipairs?