Проверка на библиотеку "Imgui"

Rice.

https://t.me/riceoff
Автор темы
Модератор
1,687
1,422
Версия MoonLoader
.026-beta
Пытался сделать проверку на "Imgui" в скрипте, при отсутствии библиотеки возвращало false.
В других скриптах работает метод, как у меня в коде. Что я делаю неправильно?

Ошибка:
Lua:
(error) Admin Answers: ....v\summer gta by lovec stew\moonloader\Admin Answers.lua:37: attempt to call field 'ImBool' (a nil value)

Код:
Lua:
require "lib.moonloader"
local sampevcheck, sampev    = pcall(require, 'samp.events')
local imguicheck, imgui     = pcall(require, 'imgui')
local inicfg                             = require 'inicfg'
local encoding                         = require 'encoding'
encoding.default                     = 'CP1251'
u8 = encoding.UTF8

local main_window_state = imgui.ImBool(false) -- 37 строчка
local two_window_state = imgui.ImBool(false)
local three_window_state = imgui.ImBool(false)
local AutoB = imgui.ImBool(mainIni.config.AutoB)
local theme = imgui.ImInt(mainIni.config.theme)
local cmd = imgui.ImBuffer(mainIni.config.cmd, 256)
local activ = imgui.ImBool(mainIni.config.activ)
local posX, posY = mainIni.config.x, mainIni.config.y
local binder_text = imgui.ImBuffer(256)
local binder_name = imgui.ImBuffer(256)

-- функция
function checklibs()
    log('Проверяю актуальность файлов игры!')
    if not doesFileExist(getWorkingDirectory()..'/config/Admin Answers.ini') then
        if inicfg.save(mainIni, 'Admin Answers.ini') then log('Директория "Admin Answers.ini" была создана!') end
    end
    if not sampevcheck then
        sampAddChatMessage('', 0x69b2ff)
        sms('У Вас отсутствует библиотека "SAMP.Lua"')
        sms('Установить её можно по ссылке - https://www.blast.hk/threads/14624/')
        sampAddChatMessage('', 0x69b2ff)
        thisScript():unload()
        return false
    else
        log('Библиотека "SAMP.Lua" присутствует!')
    end
    if not imguicheck then
        sampAddChatMessage('', 0x69b2ff)
        sms('У Вас отсутствует библиотека "Moon ImGui"')
        sms('Установить её можно по ссылке - https://www.blast.hk/threads/19292/')
        sampAddChatMessage('', 0x69b2ff)
        thisScript():unload()
        return false
    else
        log('Библиотека "Moon ImGui" присутствует!')
        --[[main_window_state = imgui.ImBool(false)
        two_window_state = imgui.ImBool(false)
        three_window_state = imgui.ImBool(false)
        AutoB = imgui.ImBool(mainIni.config.AutoB)
        theme = imgui.ImInt(mainIni.config.theme)
        cmd = imgui.ImBuffer(mainIni.config.cmd, 256)
        activ = imgui.ImBool(mainIni.config.activ)
        posX, posY = mainIni.config.x, mainIni.config.y
        binder_text = imgui.ImBuffer(256)
        binder_name = imgui.ImBuffer(256)]]
    end
    return true
end